Search Unity

Keeping changes to the scene when loading a second time

Discussion in 'Editor & General Support' started by MarcusTheBlind, Aug 23, 2020.

  1. MarcusTheBlind

    MarcusTheBlind

    Joined:
    Apr 23, 2020
    Posts:
    5
    Hello!

    I am working on a game where I need a scene to stay as it becomes when I leave it and next time I go back to that scene it should look as when I left it, I came from GameMaker and they had a room persistent function that did this, I am curious how I can achieve the same?

    I use "nodes" to build stuff on and when I go back to visit an old scene the buildings should be on the nodes where I built them in that scene. So the items should not persist through all scenes, just stay how they got modified in that particular scene. All my scenes has "nodes" and all should be unique, the nodes should not cross over between each scene.

    How I explained good enough. Thanks in advance!
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,909
    There is nothing built-in to Unity that will do this. You basically need to make a saved-game system that will keep track of any changes to scenes, and persist that to a file or other storage mechanism, then reload the scene from that data next time.
     
  3. MarcusTheBlind

    MarcusTheBlind

    Joined:
    Apr 23, 2020
    Posts:
    5
    Oh.. I see.. That's kinda bad for me xD Made so much and now I am on this step on my development, and thought it'd be easy because of previous experience. Welp.

    Do you have any examples of this? When I searched around I only found for persistent object with donotDestroy etc but that does not work for me.

    Thanks again!