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
- Crash on memcpy when using ScreenCapture.CaptureScreenshot with superSize set to zero
- [URP] Package Samples - Missing scripts in Unity 2022+
- [URP][Package Samples] Continuous "Renderer at index _ is missing for camera _" warnings when opening sample scene
- [URP] Package Samples - Missing scripts in Unity 6
- [URP] Package samples - scenes using FirstPersonController not working in Unity 6
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.