Choice enables gameobject in next scene

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Choice enables gameobject in next scene

Post by Trashrat »

Hi there,

I'm trying to impliment a system where a choice made in the dialogue will enable/disable a gameobject in the next scene, or even three/four plus scenes in advance. So far I have a boolean variable for what choice was made but now am trying to think what would be the best way to have the decision carry over to the next loaded scene. Any help in this woul dbe greatly appreciated.

Thank you
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Choice enables gameobject in next scene

Post by Tony Li »

Hi,

In the next scene, add a Dialogue System Trigger. Set its Trigger dropdown to OnSavedDataApplied. (OnSaveDataApplied works just like OnStart, except if you're coming from another scene or loading a saved game it also waits until any save data has been applied to the scene.)

Set Conditions > Lua Conditions to check the Boolean variable.

Then select Add Action > Set GameObjects Active/Inactive or OnExecute() UnityEvent (either is fine), and configure the action to activate/deactivate your GameObject.
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Re: Choice enables gameobject in next scene

Post by Trashrat »

Perfect thank you, that seems to be working great!
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Choice enables gameobject in next scene

Post by Tony Li »

Glad to help!
Post Reply