Page 1 of 1
End dialogue on video finished
Posted: Fri Jul 21, 2023 10:43 am
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!
Re: End dialogue on video finished
Posted: Fri Jul 21, 2023 10:58 am
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)
Re: End dialogue on video finished
Posted: Fri Jul 21, 2023 11:01 am
by sunny
Thanks Tony!
Re: End dialogue on video finished
Posted: Fri Jul 21, 2023 11:21 am
by Tony Li
Glad to help!