Different Scene Condition

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cungoliant
Posts: 7
Joined: Wed May 08, 2024 7:49 pm

Different Scene Condition

Post by cungoliant »

Hi, every time I decide to implement something custom, I realize that this asset already has this ability, so I wanted to ask before I start :)

In Scene A, i set a varible by;

Code: Select all

DialogueLua.SetVariable("SomeVariable", true)
Then the player goes Scene B (by conditional scene portal).

I want an object in Scene B to do something (on start probably) if "SomeVariable" is true.

I checked Quest State Listener and Condition Observer, but i don't think these are not suitable components.

Is there a component just for this task, or should i implement custom one (basically checks varible at start and does the job)

Thanks in advance
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different Scene Condition

Post by Tony Li »

Hi,

Add a Dialogue System Trigger component to a GameObject in Scene B, and set its Trigger dropdown to OnSaveDataApplied. (OnSaveDataApplied works just like OnStart except it's aware of the save system/scene changing system and will wait for save data to be applied if necessary.)

Then set the Conditions > Lua Conditions section to require that "SomeVariable" is true.

Finally, use the Actions section to do whatever you want. The most general action is the OnExecute() UnityEvent, which you can hook up to anything in the scene.
cungoliant
Posts: 7
Joined: Wed May 08, 2024 7:49 pm

Re: Different Scene Condition

Post by cungoliant »

Thanks for your help Tony
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different Scene Condition

Post by Tony Li »

Happy to help!
Post Reply