Hi Tony, another question - sorry.
I use the dialogue system trigger to open a door (setting it to false and setting the gameobject inactive) that i walk through that takes me into the next scene. When I come back out, the door is reset to it's initial gameobject "true" setting. This is what I want for this particular object.
However, I have a piece of dialogue sequence I'm using to SetActive(NPC, True) an NPC gameobject somewhere else in the scene. If I set the game object to true, it reverts to false after a scene change. How can I get it to remain true during scene transitions?
Gameobject status not saving across scene change
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Gameobject status not saving across scene change
Hi,
The values in your dialogue database (quest states, variables) will survive scene changes, assuming you haven't unticked the Dialogue Manager's Don't Destroy On Load checkbox.
To save other states, you can use the Dialogue System's save system and change scenes using one of these techniques:
Then add an ActiveSaver component to an active GameObject in the scene. It can be an empty GameObject. Assign the NPC to its GameObject To Watch field, and tick Save Across Scene Changes. The ActiveSaver will record the active/inactive state of the NPC in saved games and when leaving and returning to the scene.
BTW, to save the dialogue database values in saved games (and not just across scene changes in the same play session), add a DialogueSystemSaver component to the Dialogue Manager. (See DemoScene1 for an example of a Dialogue Manager GameObject with all of the save system components already set up.)
The values in your dialogue database (quest states, variables) will survive scene changes, assuming you haven't unticked the Dialogue Manager's Don't Destroy On Load checkbox.
To save other states, you can use the Dialogue System's save system and change scenes using one of these techniques:
- The LoadLevel() sequencer command.
- In code with SaveSystem.LoadScene().
- The equivalent visual scripting action (e.g., the PlayMaker integration's Dialogue Sysmte > Load Scene action).
- Add a SaveSystemMethods component to a GameObject and hook up a UnityEvent to call SaveSystemMethods.LoadScene.
Then add an ActiveSaver component to an active GameObject in the scene. It can be an empty GameObject. Assign the NPC to its GameObject To Watch field, and tick Save Across Scene Changes. The ActiveSaver will record the active/inactive state of the NPC in saved games and when leaving and returning to the scene.
BTW, to save the dialogue database values in saved games (and not just across scene changes in the same play session), add a DialogueSystemSaver component to the Dialogue Manager. (See DemoScene1 for an example of a Dialogue Manager GameObject with all of the save system components already set up.)
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Gameobject status not saving across scene change
Hey there, I had most of that covered. The ActiveSaver component was the key! Thanks a ton! Is there some way to add gameobjects to the list besides setting up one for each object you want to save the status of?
Re: Gameobject status not saving across scene change
Hi,
Currently it's one GameObject per ActiveSaver. I'll add an ActiveMultiSaver component in the next update that lets you assign any number of GameObjects to watch.
Currently it's one GameObject per ActiveSaver. I'll add an ActiveMultiSaver component in the next update that lets you assign any number of GameObjects to watch.