Page 1 of 2

Select response with number keys

Posted: Wed Jan 03, 2018 5:07 pm
by Caidran
Hello,

Does anyone know if it is possible to select responses by using number keys rather than having to click the response?

Not averse to having to add some custom scripting but I'm hoping I've just been a bit dense and it is actually really simple and already part of the package :)

Cheers

Re: Select response with number keys

Posted: Wed Jan 03, 2018 7:43 pm
by Tony Li
Hi,

It's easiest if you're using Unity UI. Inspect your dialogue UI, and tick Dialogue > Response Menu > Autonumber > Enabled:

Image

It numbers responses from 1. You can change the appearance by editing the Format field. If you want to assign different input buttons/keys, define your response buttons explicitly, assign them to the Buttons list, and add a UI Button Key Trigger component to each button. Devs will often do this for console games where they might assign responses to the A, B, X, and Y gamepad buttons.

Re: Select response with number keys

Posted: Thu Jan 11, 2018 2:05 pm
by Caidran
Thanks Tony, just had a chance to test. Works perfectly. 8-)

Re: Select response with number keys

Posted: Thu Jan 11, 2018 2:14 pm
by Tony Li
Great! Thanks for letting me know.

Re: Select response with number keys

Posted: Sat Mar 03, 2018 6:47 pm
by Caidran
Hello,

Just bumping this up rather than create a new thread as it's related.

I'd like to be able to select response options with the numpad as well as the regular number keys, is this possible natively through Dialogue System or will I be looking to add the key press down entries for the numpad to the regular number keys somehow?

Cheers

Re: Select response with number keys

Posted: Sat Mar 03, 2018 9:49 pm
by Tony Li
Good idea! I just added that to Unity UI Dialogue UI. You can download the updated Unity UI Support package on the Dialogue System Extras page. Expand Dialogue > Response Menu > Autonumber, and tick Numpad Hotkeys.

If you're using Text Mesh Pro, let me know. I'll need to a similar checkbox to it. Combining Unity UI and Text Mesh Pro support into a single Standard Dialogue UI is on the roadmap, but it's not ready yet.

Re: Select response with number keys

Posted: Sun Mar 04, 2018 5:25 am
by Caidran
Hi Tony,

Superb - thank you. That works perfectly as always. :D

Re: Select response with number keys

Posted: Sun Mar 04, 2018 9:17 am
by Tony Li
Happy to help!

Re: Select response with number keys

Posted: Wed Apr 04, 2018 6:36 am
by zengusan
Hi Tony, it seems that the numbering is reversed. The first entry is "3", second entry is "2", last entry is "1", etc. Please help take a look. Thanks!

Re: Select response with number keys

Posted: Wed Apr 04, 2018 10:29 am
by Tony Li
Hi @zengusan,

Are you auto-numbering instantiated buttons or explicitly-defined buttons? Instantiated buttons are created from the Button Template. Explicitly-defined buttons are assigned to the Buttons list. If you're using explicitly-defined buttons and alignment is set to ToLast, buttons are added in reverse order. In this case, you may want to set it to ToFirst instead and set up a layout group that aligns the buttons to the bottom of a panel.