Search Issue Tracker
Duplicate
Votes
0
Found in
2019.3.0a1
Issue ID
1170719
Regression
Yes
Custom Inspectors OnDisable still called after Asset has been deleted
Discovered in case 1158222.
Steps to Reproduce :
* Download the attached project
* Open the InspectorWindow and ensure it remains visible
* Select the asset in the Project Window named "SELECT THEN DELETE THIS"
* Delete the asset
Actual Result:
NullReferenceException occurs
Expected Result:
Animation Override Controller gets deleted gracefully
After this change - https://ono.unity3d.com/unity/unity/changeset/18bedf427491dea2281344bd32e6236f36a08324 - asset changes will retain the project window selection. However, if the change is a deletion of the current selection there is a risk that an inspector will try to access a null reference to the old target.
The code linked above makes a call to `GetSceneTracker().ForceReloadInspector()` which leads to us calling
internal virtual void OnForceReloadInspector()
{
if (m_SerializedObject != null)
{
m_SerializedObject.SetIsDifferentCacheDirty();
// Need to make sure internal target list PPtr have been updated from a native memory
// When assets are reloaded they are destroyed and recreated and the managed list does not get updated
// The m_SerializedObject is a native object thus its targetObjects is a native memory PPtr list which have the new PPtr ids.
InternalSetTargets(m_SerializedObject.targetObjects);
}
}
The new targets list will be a non-empty array of null objects. If we have a custom inspector that implements OnDisable, we may run into NullReferenceExceptions if we're missing checks. We will modify the Animation Override Controller's inspector, but customers may start running into exceptions if this isn't fixed at the source.
This issue may be better assigned to the Editor team.
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
- Missing Render Feature "Full Screen Pass Render Feature" in any “Universal Renderer Data” asset when upgrading from 2022.3
- Inconsistent ParticleSystemVertexStream.PercentageAlongTrail data range in Trail Texture Modes except "Stretch"
- The Graph Debug Window can be right clicked through and the Node Workspace is manipulated instead
- [Linux] Top left corner of the screen is unresponsive when the Editor recompiles
- [Android] [Vulkan] Cubes stuck on the first few frames of rotation and application flickering when an Overlay Camera is added to the Camera Stack with MSAA enabled
This is a duplicate of issue #1158081