Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2021.1.0a2
2021.1.0f1
2021.2
Issue ID
1325267
Regression
Yes
NullReferenceException thrown when calling GetWindow<>() inside ShowWindow() when called from [InitializeOnLoad] class
Reproduction steps:
1. Open the attached project "1325267Test.zip"
2. In the Project window/Assets folder, create a new script file to cause script recompilation
Expected result: No exceptions are thrown and the "TestWindow" window is shown
Actual result: "System.NullReferenceException: Object reference not set to an instance of an object" exception is thrown and the "TestWindow" window isn't shown
Reproducible with: 2021.1.0a2, 2021.1.2f1, 2021.2.0a3
Not reproducible with: 2018.4.33f1, 2019.4.24f1, 2020.3.3f1, 2021.1.0a1, 2021.2.0a4, 2021.2.0a12
Note: Sometimes it is not necessary to cause recompilation yourself by creating a new script file, recompilation might happen upon opening of the project
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 UnityPlayer!profiling::ProfilerManager::DisposeProfilerRecorder+0xa when Player gets relaunched and exited after running for a long amount of time
- [Input system] When releasing one touch and pressing a second touch during a single frame, the second touch is not translated into UI event line OnPointerDown by the InputSystemUIInputModule
- URP Samples - multiple "Attempting to resolve render surface" and other errors appear when setting Quality pipeline asset
- OnDemandRendering.willCurrentFrameRender returns incorrect values in the Player when UnityEngine.Rendering.OnDemandRendering.renderFrameInterval is greater than 1
- Root motion is not reapplied when transitioning from an animation without root motion to an animation with root motion
Resolution Note (fix version 2021.2):
Fixed in 2022.1.0a6