[SOLVED] How do I use the controller to interact with UI elements?

I’m trying to make it so that my game is also compatible with controllers but I’m not sure how to work it so that the user can use the dpad or analog to select buttons that are on screen or other UI elements. I looked up the behaviors but it seems like the only mapping available is for top down or platformer. I’m honestly not even sure where to start with this, I also tried looking it up but again just got results for mapping for platformers or top-down.

For reference I’m making a visual novel and would like players to be able to use the controller to select the dialogue options on the screen (they’re made using the button sprites). Or when I build out the settings menu and the like, I imagine those will be using buttons and sliders as well. So how do I make it so the game knows how to read input from the dpad and analog and move through the UI accordingly? (I did install the extension but I think there’s more steps that I’m just not aware of.)

I’d appreciate any help, thank you!

There’s a decent amount of additional work involved to make UI function with both gamepads and keyboards vs mouse/touch.

You can see an example on my Not-a-vania example in the main Example list. The title screen has gamepad/keyboard controls configured.

1 Like

I see, I’ll take a look at that thank you! And my understanding is if you had a vania say like Hollow Knight that had a shop or something, this is what you’d have to do to be able to use the controller to interact with the shop UI / select items / etc, right?

This is one of the ways you’d interact with any GUI elements via keyboard or gamepad, yes.

Sounds good! You said ‘one of’, do you know of other ways I can also look into?

Nope, not that I know of. But since this is a method I came up with from scratch, it’s definitely not the only way. You would have to develop the other ways with your own logic.

1 Like

I gotcha! Thanks again! :smiley: