- Home /
Couldn't read state variables in another class by reloading a scene ,Don't destroy class object on scene reload
Hi guys,
I have a project where I have a scene with buttons, texts etc. When a button will be pressed a state variable should be set in the public class backup which isn't attached to any of the gameobjects. In another class (communication), which is attached to an empty gameobject in the scene, the variables in the backup class will be set. The variables in the backup class arent't static only public. The programm works as long I stay in the scene, but when i exit the scene and will be forwareded to the main menu and afterwards load this scene again, I couldn't read the right state.
My thought is that, when the scene will be reloaded my class oject in my case :
Backup backup = new backup();
will also be destroyed and new created.
Now my question is, how is it possible to read the right state from the other class?
Greetz, Chris
Your answer

Follow this Question
Related Questions
Load menu via SceneManager 0 Answers
How to have multiple scenes concurrently runnning 3 Answers
Load AssetBundles and External Scenes dynamically 0 Answers
Not loading in Chrome 0 Answers