UI Button Key Trigger Not Working?

Announcements, support questions, and discussion for the Dialogue System.
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

UI Button Key Trigger Not Working?

Post by AlexNerd »

Hi, I'm trying to make it so the player can either continue the conversation by either clicking the continue button or pressing the return key. From what I could find, I just needed to add a UI Button Key Trigger to the Continue Button. However, I tried two different buttons with the trigger after I attached it and neither of them worked. Is there something else I need to do?
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: UI Button Key Trigger Not Working?

Post by Tony Li »

Hi,

Can you update to Dialogue System version 2.2.9? There was a bug in UIButtonKeyTrigger that could cause issues with recognizing Return or Space. If you can't update, here's a patch for UIButtonKeyTrigger:

PixelCrushers_UIButtonKeyTriggerPatch_2020-08-02.unitypackage
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Re: UI Button Key Trigger Not Working?

Post by AlexNerd »

It worked for the Escape key, but when I tried to enter the Return key, it didn't respond to it, only to the Escape key. Is there another name for the Enter key that is used?
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: UI Button Key Trigger Not Working?

Post by Tony Li »

Hi,

Are you setting the UIButtonKeyTrigger's Key dropdown or typing in a Button name? If you're typing in a Button name, make sure that button is defined in Unity's Input Manager (Edit > Project Settings > Input)
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Re: UI Button Key Trigger Not Working?

Post by AlexNerd »

I'm setting the dropdown to "Return", but I didn't put anything in the button name,
Attachments
Capture.JPG
Capture.JPG (40.32 KiB) Viewed 1243 times
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: UI Button Key Trigger Not Working?

Post by Tony Li »

Hi Alex,

That should work. Does the continue button show up during subtitles? Make sure the UI Button Key Trigger component is on the continue button GameObject.

Here's how I tested it:

1. Opened DemoScene1.

2. Set the Dialogue Manager's Subtitle Settings > Continue Button dropdown to Always.

3. Assigned the Basic Standard Dialogue UI to the Dialogue Manager's Dialogue UI field, and selected Add Instance so an instance would be in the scene as a child of the Dialogue Manager's Canvas.

4. In this instance, I added a UI Button Key Trigger to the NPC Subtitle Panel's Continue Button and set the Key dropdown to Return.

5. Played the scene and talked to Private Hart. Pressed Return to continue.
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Re: UI Button Key Trigger Not Working?

Post by AlexNerd »

Nope, still not working. The continue button is showing up and I have the UI Button on the button gameobject.
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Re: UI Button Key Trigger Not Working?

Post by AlexNerd »

Do I have to remove the Button component for this to work?
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: UI Button Key Trigger Not Working?

Post by Tony Li »

No, the UI Button Key Trigger component requires a Button component on the same GameObject.

Here's an example:

DS_ContinueUIButtonKeyTriggerExample_2020-08-19.unitypackage

It's DemoScene1, but it uses the Basic Standard Dialogue UI with Continue Button set to Always. The NPC's continue button has a UI Button Key Trigger set to the Return key.

If that doesn't help, would it be possible for you to send me a reproduction project?
AlexNerd
Posts: 39
Joined: Sat Jun 29, 2019 11:46 am

Re: UI Button Key Trigger Not Working?

Post by AlexNerd »

Well I figured out what was going on with the demo: I had the button component on the Player Continue Button and not the NPC one, but I'm using the JRPG2 UI and it doesn't have separate continue buttons. Is it not working because its deprecated?
Post Reply