Arrow keys do not work with Runic UI
-
- Posts: 40
- Joined: Sat Jul 25, 2015 2:36 pm
Arrow keys do not work with Runic UI
I have a strange bug with joystick and arrow keys input for responses in Runic UI. It seems not to work correctly. Actually, if i push arrow key many times, it even moves, but then it will go back to position 1. Checking/uncheking explicit navigation does not help. I just created a empty projdect to test this behaviour. It seems to be only runic UI problem. In Basic and Letterbox arrows work fine. In WRPG they are disabled. In Runic it always goes immedelty to position 1. Any suggestions how to fix it? Can somebody confirm this bug?
Re: Arrow keys do not work with Runic UI
Hi,
I just confirmed it. Good catch. Here are fixed versions:
DS_WRPG_Runic_UIs_2019-06-19.unitypackage
These will also be in version 2.1.8.
The way I had originally set them up, they didn't play nicely with auto-focus (i.e., keyboard/joystick navigation).
I just confirmed it. Good catch. Here are fixed versions:
DS_WRPG_Runic_UIs_2019-06-19.unitypackage
These will also be in version 2.1.8.
The way I had originally set them up, they didn't play nicely with auto-focus (i.e., keyboard/joystick navigation).
-
- Posts: 40
- Joined: Sat Jul 25, 2015 2:36 pm
Re: Arrow keys do not work with Runic UI
Thank you for the quick respond. I have replaced wrpg and runic, but now array keys look complete disabled and do not work at all. Have you disabled them? (I am using unity 2018.2.14 if it is important.)Tony Li wrote: ↑Wed Jun 19, 2019 9:35 pm Hi,
I just confirmed it. Good catch. Here are fixed versions:
DS_WRPG_Runic_UIs_2019-06-19.unitypackage
These will also be in version 2.1.8.
The way I had originally set them up, they didn't play nicely with auto-focus (i.e., keyboard/joystick navigation).
Anyway i have a pretty changed runic version, that would be added as instance, so i would really like to know what are exact changes to fix autofocus, to avoid redo my changes on runic-instance one more time.
-
- Posts: 40
- Joined: Sat Jul 25, 2015 2:36 pm
Re: Arrow keys do not work with Runic UI
UPD: Ach, i have figured it out, it actually works... sometimes.
So if i start dialogue and do nothing then, it works as intended: fist response is highlighted and arrow keys control movement. However if i click with mouse out of dialogue box (pretty common in my game) it sometimes removes highlight from response, but arrow keys work anyway. But sometimes even arrow keys do not work properly after focus lost. I would say if dialogue is activated, press of UP/DOWN should always grab focus to response. Can i actually do dialog window "modal". I can not really imagine (in my crpg game like baldurs gate) scenario, why i would want to lose focus during conversation (in WoW-like mmo games it could be the case).
upd2: I suppose change was: merging menu panel info and response container.
So if i start dialogue and do nothing then, it works as intended: fist response is highlighted and arrow keys control movement. However if i click with mouse out of dialogue box (pretty common in my game) it sometimes removes highlight from response, but arrow keys work anyway. But sometimes even arrow keys do not work properly after focus lost. I would say if dialogue is activated, press of UP/DOWN should always grab focus to response. Can i actually do dialog window "modal". I can not really imagine (in my crpg game like baldurs gate) scenario, why i would want to lose focus during conversation (in WoW-like mmo games it could be the case).
upd2: I suppose change was: merging menu panel info and response container.
Re: Arrow keys do not work with Runic UI
Hi,
Yes, my original mistake was making the Menu Panel Info GameObject, which has the StandardUIMenuPanel script, separate from Response Button Container.
Make sure the StandardUIMenuPanel's Focus Check Frequency is greater than zero, such as 0.2. You can also set Refresh Selectables Frequency to a value greater than zero, such as 1.0.
When Focus Check Frequency is non-zero, it will make sure one of the children of StandardUIMenuPanel is always focused. The original problem was that StandardUIMenuPanel was on Menu Panel Info, but the response buttons were children of Response Button Container. By moving StandardUIMenuPanel to Response Button Container, it is able to find the correct children (the response buttons).
However, if you move the mouse, the Dialogue Manager's Input Device Manager will switch to mouse mode. In mouse mode, the StandardUIMenuPanel will not keep a child button focused unless you have ticked Always Auto Focus. (In mouse-driven games, designers generally do not want to lead the player to a specific response by automatically focusing it.)
Note: If you're using a joystick and press a joystick button, the Input Device Manager will switch to joystick mode and start auto-focusing again. The StandardUIMenuPanel will auto-focus in keyboard mode or joystick mode. You can also click the Input Device Manager's Check Default Joystick Axes to switch to joystick mode if the player moves a joystick axis. When in mouse mode, the Input Device Manager does not detect changes to keyboard mode because most mouse games use a combination of mouse and keyboard, so it would be ambiguous. If you need to switch back to keyboard mode, you can manually do it in a script using:
Yes, my original mistake was making the Menu Panel Info GameObject, which has the StandardUIMenuPanel script, separate from Response Button Container.
Make sure the StandardUIMenuPanel's Focus Check Frequency is greater than zero, such as 0.2. You can also set Refresh Selectables Frequency to a value greater than zero, such as 1.0.
When Focus Check Frequency is non-zero, it will make sure one of the children of StandardUIMenuPanel is always focused. The original problem was that StandardUIMenuPanel was on Menu Panel Info, but the response buttons were children of Response Button Container. By moving StandardUIMenuPanel to Response Button Container, it is able to find the correct children (the response buttons).
However, if you move the mouse, the Dialogue Manager's Input Device Manager will switch to mouse mode. In mouse mode, the StandardUIMenuPanel will not keep a child button focused unless you have ticked Always Auto Focus. (In mouse-driven games, designers generally do not want to lead the player to a specific response by automatically focusing it.)
Note: If you're using a joystick and press a joystick button, the Input Device Manager will switch to joystick mode and start auto-focusing again. The StandardUIMenuPanel will auto-focus in keyboard mode or joystick mode. You can also click the Input Device Manager's Check Default Joystick Axes to switch to joystick mode if the player moves a joystick axis. When in mouse mode, the Input Device Manager does not detect changes to keyboard mode because most mouse games use a combination of mouse and keyboard, so it would be ambiguous. If you need to switch back to keyboard mode, you can manually do it in a script using:
Code: Select all
InputManager.instance.SetInputDevice(InputDevice.Keyboard);
-
- Posts: 40
- Joined: Sat Jul 25, 2015 2:36 pm
Re: Arrow keys do not work with Runic UI
>Always Auto Focus
Ah, thank you. It works now.
I have also tryed to connect my xbox joystick on the fly in middle of dialog. It seems not to work out of the box. Only left-right movements of left joystick work. But also somehow weired: two ansers could be highlighted at once: one by mouse, two by arrows/joystick. But it's hard stuff, probably i should try your solution with setDevice first.
Ach, it happens without joystick too. But this is not so bad, it does not stopps gameplay.
Ah, thank you. It works now.
I have also tryed to connect my xbox joystick on the fly in middle of dialog. It seems not to work out of the box. Only left-right movements of left joystick work. But also somehow weired: two ansers could be highlighted at once: one by mouse, two by arrows/joystick. But it's hard stuff, probably i should try your solution with setDevice first.
Ach, it happens without joystick too. But this is not so bad, it does not stopps gameplay.
Re: Arrow keys do not work with Runic UI
If you're doing this in the Unity editor, it sometimes doesn't properly handle connecting joysticks during playmode.Maltakreuz wrote: ↑Thu Jun 20, 2019 10:33 amI have also tryed to connect my xbox joystick on the fly in middle of dialog. It seems not to work out of the box. Only left-right movements of left joystick work.
That's normal Unity UI behavior, unfortunately. If you want to get rid of it:Maltakreuz wrote: ↑Thu Jun 20, 2019 10:33 amBut also somehow weired: two ansers could be highlighted at once: one by mouse, two by arrows/joystick.
1. Add an Event Trigger component to the response button template.
2. Click Add New Event and select Pointer Enter.
3. In the Pointer Enter (BaseEventData) section, click "+". Assign the button, and select Button.Select from the dropdown.
-
- Posts: 40
- Joined: Sat Jul 25, 2015 2:36 pm
Re: Arrow keys do not work with Runic UI
Thank you! I certainly want to get rid of multiple selected answers. I supppose mouse should have priority in such cases.