Search Issue Tracker
Fixed in 2019.3.X
NullReferenceException occurs on reloading the Inspector with a C# script selected
If you have a C# script selected in Project View and the inspector is reloaded (either by recompiling or importing/refreshing the file), a NullReferenceException will occur.
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Experimental.AssetImporters.AssetImporterEditor.InternalSetTargets (UnityEngine.Object t) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs:122)
UnityEditor.Editor.OnForceReloadInspector () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:603)
1. Open Unity
2. Open the attached project
3. Find TestScript in the Project View and select it so the Inspector displays info about it
4. Right Click on the TestScript and Reimport
5. Right Click on the TestScript and Refresh
You can also see this happen by double clicking the TestScript in Project View to open it in a code editor, make changes and then return to the editor. The error will occur after recompiling.
No errors appear in the console.
A NullReferenceException occurs in the console.
Tested on Windows.
Reproduced on 2019.3.0a4
Cannot Reproduce on 2019.2.0b3, 2019.3.0a2, 2019.3.0a3
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Changes to MeshRenderer.shadowCastingMode don't take effect immediately when being made in OnPreRender
- Pressing Control when the Scene View is in focus logs a "CommandBuffer: temporary render texture not found while executing" warning
- [Android] UI is being scaled up on some Android devices when the referenced resolution in the "Canvas Scaler" component is larger than the actual screen resolution of the device
- Resizing the Scene View causes the Editor to lag when the Canvas contains many items and it's Rect Transform size is changed
- Gizmo Settings Menu overflows to another monitor when the Scene View is expanded