void Awake()
        {
            DontDestroyOnLoad(gameObject);

            bsPlugins = new CompositeBSPlugin(PluginManager.BSPlugins);
#pragma warning disable CS0618 // Type or member is obsolete
            ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
#pragma warning restore CS0618 // Type or member is obsolete

            gameObject.AddComponent <Updating.ModSaber.Updater>();

            bsPlugins.OnApplicationStart();
            ipaPlugins.OnApplicationStart();

            SceneManager.activeSceneChanged += OnActiveSceneChanged;
            SceneManager.sceneLoaded        += OnSceneLoaded;
            SceneManager.sceneUnloaded      += OnSceneUnloaded;

            foreach (var provider in PluginManager.configProviders)
            {
                if (provider.Key.HasChanged)
                {
                    try
                    {
                        provider.Key.Save();
                    }
                    catch (Exception e)
                    {
                        Logging.Logger.log.Error("Error when trying to save config");
                        Logging.Logger.log.Error(e);
                    }
                }
            }
        }
        internal void Awake()
        {
            DontDestroyOnLoad(gameObject);

            if (!initialized)
            {
                UnityGame.SetMainThread();
                UnityGame.EnsureRuntimeGameVersion();

                PluginManager.Load();

                bsPlugins = new CompositeBSPlugin(PluginManager.BSMetas);
#pragma warning disable 618
                ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
#pragma warning restore 618

                /*
                 #if BeatSaber // TODO: remove this
                 * gameObject.AddComponent<Updating.BeatMods.Updater>();
                 #endif
                 */

                bsPlugins.OnEnable();
                ipaPlugins.OnApplicationStart();

                SceneManager.activeSceneChanged += OnActiveSceneChanged;
                SceneManager.sceneLoaded        += OnSceneLoaded;
                SceneManager.sceneUnloaded      += OnSceneUnloaded;

                var unitySched = UnityMainThreadTaskScheduler.Default as UnityMainThreadTaskScheduler;
                if (!unitySched.IsRunning)
                {
                    StartCoroutine(unitySched.Coroutine());
                }

                initialized = true;

#if DEBUG
                Config.Stores.GeneratedStoreImpl.DebugSaveAssembly("GeneratedAssembly.dll");
#endif
            }
        }
Example #3
0
        void Awake()
        {
            DontDestroyOnLoad(gameObject);

            bsPlugins = new CompositeBSPlugin(PluginManager.BSMetas);
#pragma warning disable 618
            ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
#pragma warning restore 618

            gameObject.AddComponent <Updating.BeatMods.Updater>();

            bsPlugins.OnApplicationStart();
            ipaPlugins.OnApplicationStart();

            SceneManager.activeSceneChanged += OnActiveSceneChanged;
            SceneManager.sceneLoaded        += OnSceneLoaded;
            SceneManager.sceneUnloaded      += OnSceneUnloaded;

            Config.Config.Save();
        }
        void Awake()
        {
            DontDestroyOnLoad(gameObject);

            bsPlugins = new CompositeBSPlugin(PluginManager.BSMetas);
#pragma warning disable 618
            ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
#pragma warning restore 618

            /* kill this for now, until theres a new system */
            //gameObject.AddComponent<Updating.ModSaber.Updater>();

            bsPlugins.OnApplicationStart();
            ipaPlugins.OnApplicationStart();

            SceneManager.activeSceneChanged += OnActiveSceneChanged;
            SceneManager.sceneLoaded        += OnSceneLoaded;
            SceneManager.sceneUnloaded      += OnSceneUnloaded;

            Config.Config.Save();
        }
Example #5
0
        void Awake()
        {
            DontDestroyOnLoad(gameObject);

            if (!initialized)
            {
                UnityGame.SetMainThread();
                UnityGame.EnsureRuntimeGameVersion();

                PluginManager.Load();

                bsPlugins = new CompositeBSPlugin(PluginManager.BSMetas);
#pragma warning disable 618
                ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
#pragma warning restore 618

#if BeatSaber
                gameObject.AddComponent <Updating.BeatMods.Updater>();
#endif

                bsPlugins.OnEnable();
                ipaPlugins.OnApplicationStart();

                SceneManager.activeSceneChanged += OnActiveSceneChanged;
                SceneManager.sceneLoaded        += OnSceneLoaded;
                SceneManager.sceneUnloaded      += OnSceneUnloaded;

                var unitySched = UnityMainThreadTaskScheduler.Default as UnityMainThreadTaskScheduler;
                if (!unitySched.IsRunning)
                {
                    StartCoroutine(unitySched.Coroutine());
                }

                initialized = true;
            }
        }