World Canvas and Triggering Nodes Using Button Events

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

World Canvas and Triggering Nodes Using Button Events

Post by pegassy »

Hello,

I have a game scene already built using Unity's Animator that shows dialogs on separate game objects and I am trying to transform it to work with DSU instead.

The first part of the game uses screen canvas, so I was able to adapt the DSU standard UI to it and I have a dialog tree that follows along.

However, the second part involves clicking on body parts of a character for a fight scene, and these body parts use world canvas. Each body part has a separate world canvas object and they trigger the related states.

My question is "How can I add an event to the body part world canvas buttons that will trigger a specific node in a conversation?". In other words, when I click on the "Head" button in the world canvas, I want it to continue the dialog in the same conversation from the "Head" node. I tried to add the DialogManager as a button event and use one of its method, and I can use StartConversation() method to start a new conversation, but I cannot set a variable.

Thank you for your help.
User avatar
Tony Li
Posts: 20803
Joined: Thu Jul 18, 2013 1:27 pm

Re: World Canvas and Triggering Nodes Using Button Events

Post by Tony Li »

Hi,

Add Dialogue System Trigger component to your Button GameObject. Configure the Button's OnClick() to call DialogueSystemTrigger.OnUse:

bodyPartButton.png
bodyPartButton.png (56.85 KiB) Viewed 202 times
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: World Canvas and Triggering Nodes Using Button Events

Post by pegassy »

That worked. Thank you so much Tony.
User avatar
Tony Li
Posts: 20803
Joined: Thu Jul 18, 2013 1:27 pm

Re: World Canvas and Triggering Nodes Using Button Events

Post by Tony Li »

Glad to help!
Post Reply