scene switching

First, the confession about being new to Unity and game programming in general. Now that that is out of the way I am looking for a way to switch from scene A to scene B, with the state of A frozen so I can switch back. The idea is that I want to have an inventory button so that a player can switch to an inventory scene, choose weapons/equipment/etc, and then switch back to the game proper in exactly the state he left it. Does Unity support this in some simple way (please please please) or will I have to jump through some hoops to make it happen?


You could either save information using playerprefs and reload it when you change scene.


you could have a gameobject that persists through scene changes, ie. is not destroyed. See Application.DontDestroyOnLoad() in the docs. Basically that object would have a script that maintains the info of all the inventory items you do or don't have.

Could you use


to accomplish this? I think it could work for what you are suggesting. Of course there are some other ways to do it as well, such as not even making it another screen, but more of a GUI object that will show when a flag is set correctly.

void OnGUI()
 //this needs to be in the OnGUI function so that Unity will actually render it to the GUI.
    bool showInventory;
        //Perform your inventory stuff here, such as showing the item icons and such.