Page 1 of 2
UI Button Key Trigger Not Working?
Posted: Mon Aug 17, 2020 8:25 pm
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?
Re: UI Button Key Trigger Not Working?
Posted: Mon Aug 17, 2020 9:21 pm
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
Re: UI Button Key Trigger Not Working?
Posted: Tue Aug 18, 2020 11:23 am
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?
Re: UI Button Key Trigger Not Working?
Posted: Tue Aug 18, 2020 2:04 pm
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)
Re: UI Button Key Trigger Not Working?
Posted: Tue Aug 18, 2020 2:27 pm
by AlexNerd
I'm setting the dropdown to "Return", but I didn't put anything in the button name,
Re: UI Button Key Trigger Not Working?
Posted: Tue Aug 18, 2020 9:32 pm
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.
Re: UI Button Key Trigger Not Working?
Posted: Wed Aug 19, 2020 7:41 pm
by AlexNerd
Nope, still not working. The continue button is showing up and I have the UI Button on the button gameobject.
Re: UI Button Key Trigger Not Working?
Posted: Wed Aug 19, 2020 8:11 pm
by AlexNerd
Do I have to remove the Button component for this to work?
Re: UI Button Key Trigger Not Working?
Posted: Wed Aug 19, 2020 8:30 pm
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?
Re: UI Button Key Trigger Not Working?
Posted: Wed Aug 19, 2020 9:48 pm
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?