Page 1 of 1

Different Scene Condition

Posted: Thu May 16, 2024 7:35 am
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

Re: Different Scene Condition

Posted: Thu May 16, 2024 8:01 am
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.

Re: Different Scene Condition

Posted: Thu May 16, 2024 8:07 am
by cungoliant
Thanks for your help Tony

Re: Different Scene Condition

Posted: Thu May 16, 2024 8:31 am
by Tony Li
Happy to help!