Пример #1
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
         return;
     }
     instance = this;
 }
Пример #2
0
        private void OnDestroy()
        {
            config.SetValue(this.name, windowRect);
            config.save();

            GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded);
            GameEvents.onVesselChange.Remove(onVesselChange);
            GameEvents.onHideUI.Remove(onHideUI);
            GameEvents.onShowUI.Remove(onShowUI);
            GameEvents.onGamePause.Remove(onGamePause);
            GameEvents.onGameUnpause.Remove(onGameUnpause);

            UnlockControls();
            DestroyLauncher();

            if (instance == this)
            {
                instance = null;
            }
        }