DestroyDispatcher() static private method

static private DestroyDispatcher ( MainThreadDispatcher aDispatcher ) : void
aDispatcher MainThreadDispatcher
return void
 public static void CullAllExcessDispatchers()
 {
     MainThreadDispatcher[] array = Object.FindObjectsOfType <MainThreadDispatcher>();
     for (int i = 0; i < array.Length; i++)
     {
         MainThreadDispatcher.DestroyDispatcher(array[i]);
     }
 }
 private void Awake()
 {
     if (MainThreadDispatcher.instance == null)
     {
         MainThreadDispatcher.instance        = this;
         MainThreadDispatcher.mainThreadToken = new object();
         MainThreadDispatcher.initialized     = true;
         this.updateMicroCoroutine            = new MicroCoroutine(delegate(Exception ex)
         {
             this.unhandledExceptionCallback(ex);
         });
         this.fixedUpdateMicroCoroutine = new MicroCoroutine(delegate(Exception ex)
         {
             this.unhandledExceptionCallback(ex);
         });
         this.endOfFrameMicroCoroutine = new MicroCoroutine(delegate(Exception ex)
         {
             this.unhandledExceptionCallback(ex);
         });
         MainThreadDispatcher.StartCoroutine(this.RunUpdateMicroCoroutine());
         MainThreadDispatcher.StartCoroutine(this.RunFixedUpdateMicroCoroutine());
         MainThreadDispatcher.StartCoroutine(this.RunEndOfFrameMicroCoroutine());
         UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     }
     else if (this != MainThreadDispatcher.instance)
     {
         if (MainThreadDispatcher.cullingMode == MainThreadDispatcher.CullingMode.Self)
         {
             global::Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Removing myself...");
             MainThreadDispatcher.DestroyDispatcher(this);
         }
         else if (MainThreadDispatcher.cullingMode == MainThreadDispatcher.CullingMode.All)
         {
             global::Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Cleaning up all excess dispatchers...");
             MainThreadDispatcher.CullAllExcessDispatchers();
         }
         else
         {
             global::Debug.LogWarning("There is already a MainThreadDispatcher in the scene.");
         }
     }
 }
 private void Awake()
 {
     if (MainThreadDispatcher.instance == null)
     {
         MainThreadDispatcher.instance        = this;
         MainThreadDispatcher.mainThreadToken = new object();
         MainThreadDispatcher.initialized     = true;
         Object.DontDestroyOnLoad(base.get_gameObject());
     }
     else if (MainThreadDispatcher.cullingMode == MainThreadDispatcher.CullingMode.Self)
     {
         Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Removing myself...");
         MainThreadDispatcher.DestroyDispatcher(this);
     }
     else if (MainThreadDispatcher.cullingMode == MainThreadDispatcher.CullingMode.All)
     {
         Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Cleaning up all excess dispatchers...");
         MainThreadDispatcher.CullAllExcessDispatchers();
     }
     else
     {
         Debug.LogWarning("There is already a MainThreadDispatcher in the scene.");
     }
 }