Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix when Awake can't touch MainThreadDispatcher.Instance
Browse files Browse the repository at this point in the history
remove unneed EditorThreadDispatcher.Dispose
  • Loading branch information
neuecc committed Oct 7, 2014
1 parent ee3e891 commit 1bcb411
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions Assets/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class MainThreadDispatcher : MonoBehaviour

// In UnityEditor's EditorMode can't instantiate and work MonoBehaviour.Update.
// EditorThreadDispatcher use EditorApplication.update instead of MonoBehaviour.Update.
class EditorThreadDispatcher : IDisposable
class EditorThreadDispatcher
{
static object gate = new object();
static EditorThreadDispatcher instance;
Expand Down Expand Up @@ -130,19 +130,6 @@ IEnumerator UnwrapWaitForSeconds(float second, IEnumerator continuation)
};
ConsumeEnumerator(continuation);
}

public void Dispose()
{
lock (gate)
{
if (!isDisposed)
{
isDisposed = true;
UnityEditor.EditorApplication.update += Update;
}
instance = null;
}
}
}

#endif
Expand Down Expand Up @@ -266,7 +253,7 @@ public static void Initialize()
{
#if UNITY_EDITOR
// Don't try to add a GameObject when the scene is not playing. Only valid in the Editor, EditorView.
if (!ScenePlaybackDetector.IsPlaying) return;
if (!Application.isPlaying) return; // Initialize must call from MainThread
#endif

initialized = true;
Expand Down

0 comments on commit 1bcb411

Please sign in to comment.