Initiating conversation by click on button doesn't work

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pschroed
Posts: 20
Joined: Sun Mar 05, 2023 12:15 pm

Initiating conversation by click on button doesn't work

Post by pschroed »

Hello,

I am developing a very simply adventure game in unity. There are several still images (every image on a separate canvas) between which you can navigate by buttons. By pressing a button that leads to another 'room' the canvas is set inactive and the new canvas set active.

I have also placed buttons which represent different people on the canvases. One should be able to talk to them by clicking on the button (the person).

I added a dialog system trigger to the button game object and selected the conversation that should start by clicking on the button. The trigger is set on use. The 2d physics are also activated.

The problem is that a click on the button does nothing.

I really need help.

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

Re: Initiating conversation by click on button doesn't work

Post by Tony Li »

Hi,

Do your other buttons (not connected to Dialogue System Triggers) work?

Are there any errors or warnings in the Console window?

If not, we need to look at why Unity isn't responding to button clicks. In this case, are you using Unity's built-in input manager, or the Input System package, or something else for input? Does your scene have an EventSystem?

If other buttons work, we need to look at the Dialogue System Trigger buttons. Are these UI Buttons in a Canvas? If so, does the Canvas have a Graphic Raycaster component? If you keep the Inspector view on the EventSystem GameObject, at runtime the bottom of the Inspector will show what it has detected under the mouse cursor. If you move the mouse over the button and click, does it show that your Dialogue System Trigger button is selected?

If it does, then is the UI Button's OnClick() UnityEvent configured to call the Dialogue System Trigger's OnUse() method?

If it is, then after clicking the button inspect the Dialogue System Trigger. Expand the Conditions section. Make sure it shows a green (Last Check: True) instead of a red (Last Check: False). If it's false, check the conditions in the Conditions section.

If that all checks out, temporarily set the Dialogue Manager GameObject's Other Settings > Debug Level to Info. When you click on the Dialogue System Trigger button, the Console should report something like:

Dialogue System Trigger: Firing OnUse()

This reports that the Dialogue System will try to starts its Actions. The next few lines should contain something like:

Dialogue System: Starting conversation 'title'...

However, if there's an issue starting the conversation, it may show info indicating the issue.
pschroed
Posts: 20
Joined: Sun Mar 05, 2023 12:15 pm

Re: Initiating conversation by click on button doesn't work

Post by pschroed »

Other buttons do work. For example the navigation buttons which I use to navigate between the different canvases in my game.

The console doesn't show any errors.

I think I use the built-in input manager. I didn't install the new input system package.

My scene does have an event system.

The ui-buttons are on the canvases. Every 'room' is a canvas with ui-buttons on it. Some are for navigation between the canvases which works fine, others represent persons with who you should be able to talk which doesn't work.

The canvases all have activated graphic raycaster components.

In the Inspector it doesn't show anything when I keep the event system selected and run the game. There is nothing which indicates what it has detected under the mouse cursor. Clicking the button with the dialogue system trigger does nothing. But even clicking on the navigation buttons which work doesn't result in something showing up.

But I didn't configure the UI Button's OnClick() UnityEvent to call the Dialogue system Trigger's OnUse() method.
I thought adding the dialogue system trigger component was sufficient.

How do you do that?

I added an onclick event to the button with the dialogue system trigger component (the wizardbutton) and used the Dialogue Manager Game object but I can't find the method under dialogue system controller.

Following is a picture of my game in unity which shows how the button component looks:

https://1drv.ms/i/s!AqJECbLDszktcPKmdhk ... o?e=J7ftyp
https://1drv.ms/i/s!AqJECbLDszktcU6AN1C ... o?e=LwpMLS

Thanks for your quick answer.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Initiating conversation by click on button doesn't work

Post by Tony Li »

Hi,

Is the Inspector view showing the EventSystem GameObject that's in the scene?

You may need to drag up the slider bar to show the selection details at the bottom of the Inspector:

EventSystemInspector.png
EventSystemInspector.png (54.95 KiB) Viewed 190 times

Once you can get this to work, it should help you debug the issue. My guess is that some other UI element is blocking the mouse cursor from detecting the Dialogue System Trigger's button. Or, if it's working, you may just need to connect it, like this:

buttonOnUse.png
buttonOnUse.png (65.15 KiB) Viewed 190 times
pschroed
Posts: 20
Joined: Sun Mar 05, 2023 12:15 pm

Re: Initiating conversation by click on button doesn't work

Post by pschroed »

Thanks got it to work now.

I hooked it up like you described (DialogueSystemTrigger.OnUse under On Click())

Another problem was that the image game object on the canvas covered up the Dialogue Manager Canvas.

I had to increase the sorting order of the Dialogue Manager Canvas.

So you were right again.

Strange: The Dialogue Manager Canvas was set on Screen Space - Overlay and the canvas of the button to Screen Space - Camera.

I thought that the Overlay canvas would always get on top disregarding the sorting order, but that seems not to be the case.

Your customer service is really top notch.

Many thanks.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Initiating conversation by click on button doesn't work

Post by Tony Li »

Happy to help! I'm glad you got it all working.
Post Reply