- Home /
Options UI over all scenes
Ok, so I am just looking for some input on what would be the best solution. So currently, I have one Options UI on my MainMenu scene and then from there I have DontDestroyOnLoad() script on it. Now, it sort of works fine but I have some complications, eg, when i press the esc or back button, it doesnt load my pause menu (which will only be in the game scene and not the mainmenu itself. Also for some weird reason, when I press the back button, it takes me straight back to mainmenu and I dont have a script to take me back there. The reason why I need this is because I would like the sliders and options to remain the same throughout the scenes rather than showing default values. Now yes saving the variables is the option but as I said, what would be the best way to show options whilst having the variables saved correctly?
As for the loading back to the mainmenu scene, did you you do Ctrl+F (the Find command, if you aren't on Windows I don't know other combinations) in your scripts and look for all the times that Application.LoadLevel shows up? See what times it ever loads any scenes, and try to figure out what is going on whenever it might mess up.
I dont actually have the script that changes level on my button. And the scripts that are on it dont have Application.LoadLevel either. I think its bugging because the object is only on $$anonymous$$ain$$anonymous$$enu scene rather than Level1 scene. So this is why I possibly need a better solution for the options on my scenes
Answer by Elit3d · Jan 11, 2015 at 05:03 PM
oh I know what it was, the problem was because I was trying to open the pause menu from the script like this:
if (Application.loadedLevel != 0) {
GameObject.Find("pause").SetActive(true);
}
not really sure how id actually do it but that wants to send it back to scene 0