Gamepad/Keyboard Support - Choice Selection

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Jack_Development
Posts: 6
Joined: Fri Aug 16, 2024 9:27 am

Gamepad/Keyboard Support - Choice Selection

Post by Jack_Development »

Hi all!
I'm currently working on implementing a system from the VN Template Standard Dialogue UI, and I am trying to get the basic setup for the dialogue system complete. However, I am struggling to get the choice selection to properly move and select the options with either the keyboard or gamepad.
Auto Focus is already being enabled and disabled, based on the InputDeviceManager OnKeyboard, OnJoystick, OnMouse, etc. so the options are being highlighted, however when attempting to select or navigate the choices, nothing seems to be working.

I would appreciate any advice on where to look or what settings to investigate to resolve this issue.
Many thanks.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Gamepad/Keyboard Support - Choice Selection

Post by Tony Li »

Hi,

Inspect your EventSystem GameObject. You might need to click the button to switch it from Unity's built-in input manager to the Input System package's InputSystemUIInputManager.

Then, during play, keep an inspector view on the EventSystem. The bottom of the inspector will show the current selection. Verify that it's one of the response buttons when the response menu is open.
User avatar
Jack_Development
Posts: 6
Joined: Fri Aug 16, 2024 9:27 am

Re: Gamepad/Keyboard Support - Choice Selection

Post by Jack_Development »

Hi Tony,
The EventSystem has already been updated to the new Input System, and is being used across the rest of the project, as well as being used for the Continue, and Interact buttons with the Dialogue System already, it's just the navigation and confirmation that doesn't seem to be working.
In regards to viewing the EventSystem in the Inspector, it is indeed showing the correct GameObject selected when using the keyboard and controller.

Is there something that needs to be configured for navigation with the new input system in one of the scripts?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Gamepad/Keyboard Support - Choice Selection

Post by Tony Li »

As long as the EventSystem shows that a response button is selected, navigation is entirely out of the Dialogue System's hands.

You can inspect the response buttons to make sure their Navigation sections look correct, but apart from that I suggest checking the input actions assigned to the EventSystem's InputSystemUIInputModule. Also check the Console window for any errors or warnings.
User avatar
Jack_Development
Posts: 6
Joined: Fri Aug 16, 2024 9:27 am

Re: Gamepad/Keyboard Support - Choice Selection

Post by Jack_Development »

Hi Tony,
Thanks for your comments and response!
I've found that the "Send Navigation Events" toggle in the Events System was being disabled at runtime for some reason?
I've added some code to reenable and disable these events at the start and end of conversations, and that seems to have fixed the issue.
Once again, thanks for your support!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Gamepad/Keyboard Support - Choice Selection

Post by Tony Li »

Hi,

Are you using More Mountains' Inventory Engine? It turns off navigation events when its inventory UI isn't open.
User avatar
Jack_Development
Posts: 6
Joined: Fri Aug 16, 2024 9:27 am

Re: Gamepad/Keyboard Support - Choice Selection

Post by Jack_Development »

Hi Tony,
Yes, you are correct, I am using the Inventory Engine, the "Input Only When Open" setting was enabled, which is what was disabling the events at runtime.
I've disabled those settings in the canvases for the inventories, and am putting in failsafes for that to prevent the loss of input by disabling the inventory toggle during dialogue.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Gamepad/Keyboard Support - Choice Selection

Post by Tony Li »

There's also an Inventory Engine integration package that has some useful utility scripts.
User avatar
Jack_Development
Posts: 6
Joined: Fri Aug 16, 2024 9:27 am

Re: Gamepad/Keyboard Support - Choice Selection

Post by Jack_Development »

Hi Tony,
Are there any specific pages on the documentation for writing custom lua scripts for calling functions on the Inventory Engine systems? I am looking to open and close the inventories during the conversation, and can't seem to find support that.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Gamepad/Keyboard Support - Choice Selection

Post by Tony Li »

The integration itself doesn't include those functions, but here's the reference for registering your own C# methods with Lua: Registering C# Methods With Lua

And here's the reference for the functions it does include: Inventory Engine Lua Functions
Post Reply