Making Button/Selectable not react to "Submit" action, but without disabling them

1.2k views Asked by At

I'm implementing controller navigation in my settings menu and

I've set up a bunch of options with buttons that you can choose from by pressing left/right while the button is selected.

Options

Applying the options is handled by WestButton (square) on the controller.

Current behaviour: When pressing Submit, the highlight disappears completely and the BaseEventData's SelectedObject nulls out, leaving no button selected, breaking navigation completely.

Intended behaviour: When pressing Submit, I want nothing to happen, and the selected button to remain selected, so the user can still cycle left/right to change the option. Turning off button.interactable is not a solution for this case.

I also tried:

  • setting up the options with Selectables instead of Buttons but the exact same thing happens
  • setting up event triggers on the Buttons/Selectables that do Selectable.Select/Button.Select on Submit to no avail
  • making a new Action Map where I removed the "Submit" key bindings, but it breaks navigation too, when I swap it out on runtime, despite it being a complete duplicate of the original Action Map
  • Disabling the "Submit" value in my InputSystemUIInputModule to no avail InputSystemUIInputModule

Any ideas please? Thank you for your time.

2

There are 2 answers

0
The Embraced One On BEST ANSWER

I cant explain how, but "Deselect on Background Click" was the reason for this not working, despite my project only being set up to exclusively work with gamepad input, so no mouse input could interfere. Disabling "Deselect on Background Click" solved the issue.

1
Udhaya On

If you wanted to your button to be pressed only once then make it button.intractable=false or use this