示例#1
0
        /// <summary>
        /// Only ever called once, mainly used to initialize variables.
        /// </summary>
        private void Awake()
        {
            // For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property
            //   and destroy any that are created while one already exists.
            if (Instance != null)
            {
                Logger.log?.Warn($"Instance of {this.GetType().Name} already exists, destroying.");
                GameObject.DestroyImmediate(this);
                return;
            }
            GameObject.DontDestroyOnLoad(this); // Don't destroy this object on scene changes
            Instance = this;

            var cam2check = PluginManager.GetPlugin("Camera2");

            if (cam2check != null)
            {
                cam2 = true;
            }
            else
            {
                cam2 = false;
            }


            //Begin MSC checking folders and files
            if (!Directory.Exists(moveScriptChangerPath))
            {
                CreateMoveScriptChangerFiles();
            }
            //End MSC checking folders and files

            ScanMoveScriptPool(); //MSC scan Pool


            BS_Utils.Utilities.BSEvents.gameSceneActive -= ChangeMovescript;
            BS_Utils.Utilities.BSEvents.gameSceneActive += ChangeMovescript;
        }
示例#2
0
 /// <summary>
 /// Called when the script is being destroyed.
 /// </summary>
 private void OnDestroy()
 {
     Logger.log?.Debug($"{name}: OnDestroy()");
     Instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null.
     BS_Utils.Utilities.BSEvents.gameSceneActive -= ChangeMovescript;
 }