- Home /
Remembering the state of a scene
Hi, i need some advice.
Im new to unity but kinda starting to find my way in it. Im building a point and click game with different scenes. The player interacts with the scene, lets say he opens a door, and thus the door-object ist changing its texture. Now, what is the best option to save this state so when i go to another scene an them return the door eill be still open, although it's not the scenes starting preference.
I googled and searched and found some ways : thru playerprefs, which seems pretty hard. Do i have to like save the state of the door (its texture) the moment it changes, and when entwrng the scene anew, load this thru the playerprefs? And this with every object and any change?
: i saa this plugin, unityserializer, which seems good. Is it the right thing for me? Can i load the saved objects and their states of a scene when i get into it and save them when i leave to another scene?
: is it maybe possible to make objects and their preferences static, like, they won't change when i leave the scene and starting it anew?
Thanks for the answer. :)
Answer by Rambit · Jun 11, 2013 at 08:21 PM
I'm kinda new myself but the way I would solve it would be to have just one scene. Every room is it's own GameObject with everything in the room as a child of that GO. Then I would just deactivate/activate rooms(the parent GameObject) accordingly to what door you enter.
Eg: When you enter a the door in Room1 to Room2, you just deactivate the Room1 Gameobject and activate the Room2 GameObject. When you go back through the door you just do the opposite and everything will be the way it was before you deactivated it.
I don't know if this is the best way to do it, but I think it would make it a lot easier than saving everything to Playerprefs or using a Plugin.