Search Issue Tracker

Won't Fix

Votes

0

Found in [Package]

9.0.0, 8.1.0, 8.0.1

Issue ID

1242029

Regression

No

[HDRP] ArgumentNullException and NullReferenceException errors are thrown on removing Camera Component from its preset asset

Package: Scriptable Render Pipeline HD

-

-ArgumentNullException and NullReferenceException errors are thrown on removing Camera Component from its preset asset.
-MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.

Steps to repro:
1. Create a new HDRP project.
2. Select the Main Camera > Create its preset.
3. Select Camera preset > Inspector > Remove Camera component.

Actual Result:
ArgumentNullException and NullReferenceException errors are thrown in the console.

Expected Result:
No error in the console.

Reproducible in:
2020.2.0a9, 2020.1.0b8, 2020.1.0a23 with Package Version 9.0.0, 8.1.0, 8.0.1.

Note: In package Version 7.3.1 there is no provision to remove Camera component from its preset asset.

Environment:
Occurring on Windows 10 & Mac 10.15.

stack trace:
SerializedObject target has been destroyed.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

ArgumentNullException: Value cannot be null.
Parameter name: source
UnityEditor.Presets.PresetEditor.DrawInternalInspector () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.DrawPresetData () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.OnInspectorGUI () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AssetDatabase.IsMainAsset (UnityEngine.Object obj) (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.OnHeaderControlsGUI () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header, System.Single leftMargin) (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header) (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.OnHeaderGUI () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.DrawHeaderFromInsideHierarchy () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Editor.DrawHeader () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.DrawInternalInspector () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.DrawPresetData () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.OnInspectorGUI () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEditor.Presets.PresetEditor.DestroyInternalEditor () (at <5951c2421c324f47883bd5ba8a4bf507>:0)
UnityEditor.Presets.PresetEditor.OnDisable () (at <5951c2421c324f47883bd5ba8a4bf507>:0)

  1. Resolution Note:

    This is a known issue and there is an ongoing effort for 2021 to solve it. This also applies to Light component. Closing as won't fix. We hope to solve this in 2021

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.