Using Toolbox Singleton Script and Reloading Scene

I was trying to use the script here - I attached it to a GameObject and was putting my global vars. It works well. But if I reload the scene, I get a warning “[Singleton] Instance ‘Toolbox’ already destroyed on application quit. Won’t create again - returning null.” And I can’t access my global vars again. So how do I use this script and different scenes together ?

Add a method to the Singleton class:

        public void Reload()
            applicationIsQuitting = false;

Then call it from Toolbox.Awake() using this.Reload();

Well, the singleton implementation which is used by the toolbox is missing a DontDestroyOnLoad in the “else” branch. The else branch is the case when you already have an instance in the scene. Since DontDestroyOnLoad is not called in this case, the instance get destroyed on scene change and due to the OnDestroy check never restored.

All you have to do is to add this line to the else branch of the singleton: