End dialogue on video finished

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
sunny
Posts: 2
Joined: Fri Jul 21, 2023 10:37 am

End dialogue on video finished

Post by sunny »

Hi everyone,

I'm new to this plugin and absolutely blown away! A huge thanks to the developers and community!!

When a dialogue is typewriting on screen, I am also playing a video. I want the choices to appear only after the video is finished. If I write a script that triggers an event on video finish, how can I hook that into the dialogue system?

Apologies if this is documented somewhere, I did a search and didn't find anything.

Thanks!
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: End dialogue on video finished

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

Each dialogue entry node will advance when its Sequence has finished. If the node's Sequence field is blank, it will use the Dialogue Manager GameObject's Display Settings > Camera & Cutscene Settings > Default Sequence. (More info: Cutscene Sequences)

To make the node that's playing the video advance only after the video has finished, use the WaitForMessage() sequencer command in the node's Sequence field, which will wait for a message sent by another sequencer command or by the C# method Sequencer.Message(). For example, say you're starting the video by using a SetActive() sequencer command to set a video player GameObject active. Then set the node's Sequence to something like:

Code: Select all

SetActive(YourVideoPlayer);
WaitForMessage(VideoDone)
In your event that triggers on video finish, use this C# code:

Code: Select all

PixelCrushers.DialogueSystem.Sequencer.Message("VideoDone");
Note: If you require the player to click a continue button to advance the conversation, but you don't want to require the player to click continue on this node, change the Sequence to:

Code: Select all

SetActive(YourVideoPlayer);
Continue()@Message(VideoDone)
sunny
Posts: 2
Joined: Fri Jul 21, 2023 10:37 am

Re: End dialogue on video finished

Post by sunny »

Thanks Tony!
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: End dialogue on video finished

Post by Tony Li »

Glad to help!
Post Reply