Wait for objects to load before firing off Dialogue System Trigger On Start

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Vomdrache
Posts: 21
Joined: Wed Aug 18, 2021 1:00 pm

Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Vomdrache »

Hey there,

I've recently come into an issue where the Dialogue System Trigger component is firing off before the game has fully loaded.
  • I have a Gameobject with a Dialogue System Trigger attached
  • The Dialogue System Trigger toggles between 3 different states depending on what value exists on another script
  • On Start the Dialogue System Trigger is checking the value on the other script before the saved value is applied to it
This issue does not seem to happen when saving/loading while transitioning between two scenes, only when loading into the game from the start menu - I assume this is because the Gameobject storing the data is persistent though scenes.

I believe the proper solution would include having a "loading scene" before where all of the data is settled before any On Start events are fired off - but I was hoping there was a temporary work around.

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

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Tony Li »

Hi Frank,

Try setting your Dialogue System Trigger to OnSaveDataApplied instead of OnStart.

Alternatively, if there's another reason the game isn't fully loaded yet, such as non-Dialogue System components still initializing, set the Dialogue System Trigger to OnUse. Add a Timed Event component to the same GameObject. Set the time duration in frames or seconds, and configure the OnTimeReached() event to call DialogueSystemTrigger.OnUse.
Vomdrache
Posts: 21
Joined: Wed Aug 18, 2021 1:00 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Vomdrache »

Hey Tony,

Thanks for the quick reply. The OnSaveDataApplied would be ideal but it doesn't show up as an option on the component. Any idea why that might happen?
Screen Shot 2021-10-27 at 9.58.17 PM.png
Screen Shot 2021-10-27 at 9.58.17 PM.png (127.18 KiB) Viewed 622 times
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Tony Li »

Hi,

It's a fairly new addition. You'll need to update to a newer version of the Dialogue System to see it. (If you do, please back up your project first just to be safe, as when importing any package or asset.)
Vomdrache
Posts: 21
Joined: Wed Aug 18, 2021 1:00 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Vomdrache »

Package Manager says I'm running version Version 2.2.21 of the Dialogue System, is that the latest?
Would I need to re-import the package after updating? I'm still not seeing that trigger in the dropdown options.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Tony Li »

Hi,

Please see How To: Download Updates With Broken Package Manager

It's possible that you're still using an older version. To verify, select menu item Tools > Pixel Crushers > Dialogue System > Welcome Window or open the file Plugins / Pixel Crushers / Dialogue System / _README.txt and check the version number.
Vomdrache
Posts: 21
Joined: Wed Aug 18, 2021 1:00 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Vomdrache »

The reimport has brought up a good amount of bugs to keep me busy with, but the trigger is now showing up and does work as intended lol.

Thanks for the assistance!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Wait for objects to load before firing off Dialogue System Trigger On Start

Post by Tony Li »

Glad to help! If you get stuck on anything related to the update/reimport, just let me know.
Post Reply