Search Issue Tracker
By Design
Votes
0
Found in
2021.3.34f1
2022.3.17f1
2023.2.5f1
2023.3.0b3
Issue ID
UUM-60620
Regression
No
NullReferenceException is thrown when opening a custom UI Toolkit Editor Window
Reproduction steps:
1. Open the attached “Repro“ project
2. Open the Custom Editor Window (Window > UI Toolkit > MyCustomEditor)
3. Observe the Window and Console
Expected result: No errors/logs are present and there's a Button and a Toggle in the MyCustomEditor Window
Actual result: NullReferenceException is thrown and there are no Button or Toggles seen in the MyCustomEditor Window
Reproducible with: 2021.3.34f1, 2022.3.17f1, 2023.2.5f1, 2023.3.0b3
Reproducible on: M1 MacOS 14.2
Not reproducible on: No other environment tested
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Scene Filter buttons reset to "All" in the Occlusion Window when entering Play Mode but the Scene Filters themselves do not reset
- Transition property is not disabled in the UI Builder when it is set by a variable
- Crash on PersistentManager::GetSerializedType when opening a specific Scene
- GlobalObjectId.GetGlobalObjectIdSlow returns empty ID when in Prefab Isolation Mode
- Crash on Transform::RemoveFromParent when deleting a child GameObject
Resolution Note:
The NullReferenceException occurs because no VisualTreeAsset was assigned on the MyCustomEditor script. To fix it, click the MyCustomEditor.cs asset in the Project Window, and assign a VisualTreeAsset to the field in the Inspector Window.