示例#1
0
 protected virtual void OnDestroy()
 {
     if (mInstance == this)
     {
         Exists    = false;
         mInstance = null;
     }
 }
示例#2
0
 protected virtual void Awake()
 {
     if (mInstance == null)
     {
         mInstance = this;
         Exists    = true;
     }
     else
     {
         if (mInstance != this)
         {
             Debug.LogWarning("Two Instance" + typeof(T).ToString());
             Destroy(mInstance);
             mInstance = this;
         }
     }
 }