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

            _instance = this;
        }