Search Issue Tracker

By Design

Votes

0

Found in [Package]

1.1.0-preview.14

Issue ID

1345865

Regression

No

Disabling the 'Deselect On Background Clicks' option in Input Module component doesn't work when using UIToolkit

Package: UI Toolkit

-

How to reproduce:
1. Open the attached project's Scene labeled "Main Menu"
2. Enter the Play Mode
3. In the Game View, move the Gamepad's Left Joystick (to select visual elements)
4. Using the mouse, click on the background
5. Inspect the Console Window

Expected result: Currently selected visual element is not null
Actual result: Currently selected visual element is null

Reproducible with: 2021.2.0b4, 2022.1.0a2
Couldn't test with: 2019.4.29f1 (UI Toolkit is not available), 2020.3.14f1, 2021.1.16f1 (Project breaks when downgrading)

  1. Resolution Note:

    The UIDocument in the repro project has a white background ("#wrap") that covers the entire GameView window and that has PickingMode=Position. This means that clicking on it will deselect any other selected element, as per the design of UI Toolkit, and as would happen in a regular, non-runtime EditorWindow. I've just verified that setting PickingMode=Ignore on the background element does indeed stop the deselection from happening.

    I have also tested the DeselectOnBackgroundClick option in an empty scene with just 1 UIDocument with 1 TextField, and a GameObject with the EventSystem + InputSystemUIInputModule components. Clicking in the background does deselect the TextField, if and only if the DeselectOnBackgroundClick option is enabled.

    This feature seems to be working as intended.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.