Search Issue Tracker

Active

Votes

1

Found in

2020.3.46f1

Issue ID

UUM-31504

Regression

No

Shader Graph Editor Throws Exception When Deleting Custom Function Node

--

-

How to reproduce:
1. Download the attached project
2. Open the "New Shader Graph" in the Shader Editor
3. Add a "Custom function" node
4. Remove the "Custom function" node
5. Observe the console window

Expected outcome: No errors appear
Actual outcome: "ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Index out of range: -1" error appears in the console

Reproducible with: 2020.3.46f1, 2021.3.21f1, 2022.2.11f1, 2023.1.0b8, 2023.2.0a6
UnityEngine.UIElements.VisualElement+Hierarchy.RemoveAt (System.Int32 index) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.Remove (UnityEngine.UIElements.VisualElement child) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement.RemoveFromHierarchy () (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEditor.Experimental.GraphView.IconBadge.OnTargetDetachedFromPanel (UnityEngine.UIElements.DetachFromPanelEvent evt) (at <7bc82e783de8484692ac600820efa656>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetAndDefaultPhase (UnityEngine.UIElements.EventBase evt) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement.WillChangePanel (UnityEngine.UIElements.BaseVisualElementPanel destinationPanel) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement.SetPanel (UnityEngine.UIElements.BaseVisualElementPanel p) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.SetParent (UnityEngine.UIElements.VisualElement value) (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement+Hierarchy.Clear () (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEngine.UIElements.VisualElement.Clear () (at <8afd0ed9f16a4f65b41dafeb31525d3d>:0)
UnityEditor.ShaderGraph.Drawing.MaterialNodeView.Dispose () (at ./Library/PackageCache/com.unity.shadergraph@14.0.6/Editor/Drawing/Views/MaterialNodeView.cs:842)
UnityEditor.ShaderGraph.Drawing.GraphEditorView.HandleRemovedNodes () (at ./Library/PackageCache/com.unity.shadergraph@14.0.6/Editor/Drawing/Views/GraphEditorView.cs:885)
UnityEditor.ShaderGraph.Drawing.GraphEditorView.HandleGraphChanges (System.Boolean wasUndoRedoPerformed) (at ./Library/PackageCache/com.unity.shadergraph@14.0.6/Editor/Drawing/Views/GraphEditorView.cs:698)
UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Update () (at ./Library/PackageCache/com.unity.shadergraph@14.0.6/Editor/Drawing/MaterialGraphEditWindow.cs:372)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
```

2. How can we reproduce it using the example you attached

Create any shader graph.
Add a custom function node.
Delete the function node.

3. Additional behaviours

The node can be deleted if the node is configured and does not have any errors in the shader code.

If you save the shader graph before deleting the node, the node can never be deleted unless you manually configure a valid custom function.

After a exception is thrown, the shader graph cannot be saved.

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.