Automatic button selection

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nory
Posts: 1
Joined: Sat Aug 06, 2022 2:40 pm

Automatic button selection

Post 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.
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Automatic button selection

Post 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.
Post Reply