Search Issue Tracker

Active

Votes

0

Found in

6000.0.59f1

6000.2.7f1

6000.3.0b4

6000.4.0a1

Issue ID

UUM-121130

Regression

Yes

NullReferenceException is thrown when specific UI Toolkit focus changes are made

-

How to reproduce:
1. Open the ‘Bug.zip' project
2. Open the ‘Scene’ scene
3. Enter Play Mode
4. In the Game View select the 'Example1A’ button
5. Observe the result

Expected result: No errors are thrown in the console
Actual result: Errors are thrown in the console

Reproducible with: 2023.2.0a6, 6000.0.59f1, 6000.2.7f1, 6000.3.0b4, 6000.4.0a1
Not reproducible with: 2023.2.0a5

Reproducible on: macOS 26.0 (M1 Max)
Not reproducible on: No other environments tested

Notes: The issue is that SwitchFocus doesn't check whether the last focused element is still in a panel. In a specific case where there's pending focus changes, and you attempt to focus something while the previous element is being removed, and events are being processed, then the line of code `using (new EventDispatcherGate(oldFocusedVe.panel.dispatcher))` will attempt to access a null panel.

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.