Page 1 of 1

Keep Spawned Objects active between Scenes

Posted: Mon Mar 06, 2023 6:38 pm
by Kylter
Hi Guys,
im new to the Dialogue System and trying to build my first Quest thanks to the Tutorials, it's mostly working. My Problem is that I spawn 4 Objects which should be collected and when I switch Scenes and come back they are turned off again, but the Quest state didn't change. I already got the Saving System running. Is there a Way without a new Script which keeps Checking the Object and Quest State? Any Ideas?

Thanks :D

Re: Keep Spawned Objects active between Scenes

Posted: Mon Mar 06, 2023 9:03 pm
by Tony Li
Hi,

You say the objects are turned off when you return to the scene. If the objects are in the scene at design time and you're setting them active when you activate the quest, then use a MultiActiveSaver component. Put this component on a GameObject that stays active in the scene. An empty GameObject is fine. Then assign a unique Key value and assign your 4 quest objects to the Targets list.

If you're actually spawning the objects at runtime from (e.g., instantiating from prefabs), use the save system's SpawnedObjectManager: Add a SpawnedObject component to the prefab. Add a SpawnedObjectManager to the scene, assign a unique Key value, and assign the prefab to the prefabs list. You can read more about the SpawnedObjectManager in the Save_System_Manual.pdf in Plugins > Pixel Crushers > Common > Documentation.

Make sure you're changing scenes with a method that uses the save system: How To: Change Scenes With Save System.