示例#1
0
 private void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
示例#2
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
         InitializeMenus();
         DontDestroyOnLoad(gameObject);
     }
 }