Page 1 of 1

Automatic button selection

Posted: Thu Aug 11, 2022 12:50 pm
by nory
Heya,
I'm having trouble with the auto-selection of buttons in my dialogue UI.

Currently, the open state looks like this:
Image

When the subtitle panel is shown, the continue button is properly selected and reacts to submit as intended.
When the panel is hidden, I have the continue button set as non interactable, leading to the following issue:
Image

As shown in the EventSystem's inspector, one of the control buttons gets auto-selected. This in turn causes the submit button to open the message log.

I've tried several things like disabling navigation on the buttons, to no avail. Auto-deselecting the control buttons whenever they get selected in turn leads to some very erratic behaviour. Keeping the continue button interactable throughout causes another bag of problems entirely, so I'd like to avoid going down that route.

Ideally, I'd like to find a way for the control buttons to not be auto-selected at all and only respond to either the assigned Key trigger or mouse clicks on the button itself. I did some digging through the UI panel scripts and also read up a bit in the Input System sections of the unity documentation, but so far I couldn't figure out which script is responsible the auto-selection.

I'd thus very much appreciate if you could give me a few pointers as to where auto-selection of interactable Buttons on the screen is handled.

Re: Automatic button selection

Posted: Thu Aug 11, 2022 1:46 pm
by Tony Li
Hi,

The short way to disable automatic selection is via code. Run this at the beginning of your game:

Code: Select all

PixelCrushers.UIPanel.monitorSelection = false;
A different way to do it is:
  • On the Dialogue Manager GameObject's Input Device Manager component, ensure Always Auto Focus is UNticked.
  • On the subtitle panels, unassign First Selected. Set Focus Check Frequency and Refresh Selectables Frequency to zero.