Example #1
0
 private void OnDestroy()
 {
     if (this == instance)
     {
         instance = null;
     }
 }
Example #2
0
        private void Awake()
        {
            if (instance)
            {
                Destroy(gameObject);
                return;
            }

            instance = this;
        }