Page 1 of 1

Tapping into DialogueSystem Events Globally from Code

Posted: Tue Jun 13, 2023 9:51 pm
by Itilos
Hello!

Is there a way to easily tap into DialogueSystemTrigger events via code?

I know you can set up events and assign Gameobjects, but I am looking to (for example), always hide the player UI when conversations start. Rather than assigning an action to every trigger to do that in every scene - is there a way I can tap into the OnConversationStart via script, so my UI knows that when that fires, it should always disable?

I'm trying to figure out what the intended way of interfacing with this is.

Re: Tapping into DialogueSystem Events Globally from Code

Posted: Tue Jun 13, 2023 11:26 pm
by Tony Li
Yes, add a Dialogue System Events component to your player. Configure the OnConversationStart() UnityEvent to hide the UI. Configure OnConversationEnd() to show it again. Your player should be the active conversation's actor or conversant for this to work. For more info on GameObject assignments, see: Character GameObject Assignments. For a video explanation, see 07:00 of the Interaction Tutorial.

Alternatively, hook into the C# events DialogueManager.instance.conversationStarted and conversationEnded.

Re: Tapping into DialogueSystem Events Globally from Code

Posted: Thu Jun 15, 2023 12:11 am
by Itilos
Thank you! This was super helpful.

Re: Tapping into DialogueSystem Events Globally from Code

Posted: Thu Jun 15, 2023 9:12 am
by Tony Li
Glad to help!