Best way to trigger dialogue at specific key frame in Unity animation.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
migardene
Posts: 1
Joined: Tue Oct 20, 2020 8:52 am

Best way to trigger dialogue at specific key frame in Unity animation.

Post by migardene »

I want to trigger dialogue base on specific keyframe at specific animation
I can put event on to that specific keyframe to trigger C# function
The problem is, I don't know how to properly use C# function to trigger the dialogue with this system yet.

I watched the tutorial video Dialogue System for Unity 2.x - Cutscene Sequences - Part 3: Messages & Timing
I can use use WaitForMessage(the string) in the Sequence (Trigger set to On Start and dialogue will wait for the message?)
And then I can call one of the function that have this inside
PixelCrushers.DialogueSystem.Sequencer.Message("the string");

Then my dialogue will get trigger, I think.

Any better way to do this? because this can involved a lot of strings.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best way to trigger dialogue at specific key frame in Unity animation.

Post by Tony Li »

Hi,

Do you want to start a new conversation at a specific keyframe? Or make the current conversation continue at the specific keyframe?

To start a new conversation, you could set up a Dialogue System Trigger and call its OnUse() method in your C# method, or you could manually start it by calling DialogueManager.StartConversation():

Code: Select all

DialogueManager.StartConversation("Title", actorTransform, conversantTransform);
To make the current conversation continue, you can simulate a continue button click:

Code: Select all

public void MyAnimationEvent()
{
    (DialogueManager.dialogueUI as StandardDialogueUI).OnContinue();
}
Post Reply