Example #1
0
    void OnDestroy()
    {
        // Stopping all coroutines, even if this is not our original coroutine
        StopAllCoroutines();

        if (this == _instance)
        {
            _instance = null;
        }
    }
Example #2
0
 void Awake()
 {
     if (_instance != null)
     {
         Debug.LogWarning("There is another instance of " + this + " already. Destroying the new one");
         Destroy(this);
         return;
     }
     _instance = this;
     Scale     = Time.timeScale;
     _instance.StartCoroutine(UpdateDeltaTime());
 }