Unable to edit some shadergraphs "ArgumentNullException: Value cannot be null"

Having an issue with editing shadergraphs.

I downloaded this toonshader sample from github:

Opened in Unity 2020.2.1f1, with URP/Shadergraph 10.2.2 and keep getting an error in the CharacterToonV2 shadergraph whenever I try to edit, or just move, a node:
“ArgumentNullException: Value cannot be null.
Parameter name: identifier” (full error below)

When this happens I can’t edit anything in the graph.
I’ve tried solutions I found to similar problems people have had on the forums like, restarting unity, rebuilding library folder, resizing the material preview window, reloading UI, but the error persists.
The shader works fine in the viewport, and the other shadergraphs in the project can be edited.

Any idea how to get around this?

Full error message:

ArgumentNullException: Value cannot be null.
Parameter name: identifier
UnityEditor.Undo.RegisterCompleteObjectUndo (UnityEngine.Object objectToUndo, System.String name) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEditor.Graphing.GraphObject.RegisterCompleteObjectUndo (System.String actionName) (at Library/PackageCache/com.unity.shadergraph@10.2.2/Editor/Data/Implementation/GraphObject.cs:54)
UnityEditor.ShaderGraph.Drawing.GraphEditorView.GraphViewChanged (UnityEditor.Experimental.GraphView.GraphViewChange graphViewChange) (at Library/PackageCache/com.unity.shadergraph@10.2.2/Editor/Drawing/Views/GraphEditorView.cs:454)
UnityEditor.Experimental.GraphView.SelectionDragger.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at <ae0922aaaca441548dd02e17bb301e1c>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0)

I’ve recently filed a bug report describing pretty much this. In my case, it felt like it was somehow related to graph complexity and having too many keyword properties in the graph + nested sub graphs.

Have you got a bug report ID to hand?

I believe it’s case number 1304168.

Many thanks. I’ll ask the team to get an update to you.

Just got this error and lost half a days work, did anything come of this. This is quite maddening.

I’m having the same issue but on SubGraph objects. Every time I open a subgraph (new or otherwise) and try editing anything I get the same error message as OP’s. Trying to save the graph with the save asset button does nothing but shows (nothing loaded) next to the asset’s name in the name tab.

6978203--823127--after_save_asset.JPG

Currently on Unity 2021.1.0f1 and URP 11.0.0. I’ve tried removing and reinstalling the URP package as well as deleting the Library folder. Nothing worked so far.

I’m consistently getting this error even when starting a new project from scratch.
Steps to reproduce

  • Create a new URP project
  • Create a SubGraph and open it to edit
  • Create a new property and name it
  • Error shows up as soon as I click the property to drag it into the graph

Notes

  • I’m able to create and connect nodes normally, as well as save the graph as long as I don’t define any custom properties
  • Non subgraph shadergraphs work normally
  • May or may not be related, but my editor view is really laggy when using vertex displacement in my shaders, but it runs smoothly when I move the editor camera and keep a mouse button or key pressed after moving.

Full error message

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers.ShaderInputPropertyDrawer.UpdateEnableState () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs:142)
UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers.ShaderInputPropertyDrawer.DrawProperty (System.Reflection.PropertyInfo propertyInfo, System.Object actualObject, UnityEditor.ShaderGraph.Drawing.InspectableAttribute attribute) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs:108)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorUtils.GatherInspectorContent (System.Collections.Generic.List`1[T] propertyDrawerList, UnityEngine.UIElements.VisualElement outputVisualElement, UnityEditor.ShaderGraph.Drawing.IInspectable inspectable, System.Action propertyChangeCallback, UnityEditor.ShaderGraph.Drawing.IPropertyDrawer propertyDrawerToUse) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:195)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorView.DrawInspectable (UnityEngine.UIElements.VisualElement outputVisualElement, UnityEditor.ShaderGraph.Drawing.IInspectable inspectable, UnityEditor.ShaderGraph.Drawing.IPropertyDrawer propertyDrawerToUse) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:140)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorView.Update () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:126)
UnityEditor.ShaderGraph.Drawing.GraphEditorView.HandleGraphChanges (System.Boolean wasUndoRedoPerformed) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Views/GraphEditorView.cs:654)
UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Update () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/MaterialGraphEditWindow.cs:330)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers.ShaderInputPropertyDrawer.UpdateEnableState () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs:142)
UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers.ShaderInputPropertyDrawer.DrawProperty (System.Reflection.PropertyInfo propertyInfo, System.Object actualObject, UnityEditor.ShaderGraph.Drawing.InspectableAttribute attribute) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs:108)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorUtils.GatherInspectorContent (System.Collections.Generic.List`1[T] propertyDrawerList, UnityEngine.UIElements.VisualElement outputVisualElement, UnityEditor.ShaderGraph.Drawing.IInspectable inspectable, System.Action propertyChangeCallback, UnityEditor.ShaderGraph.Drawing.IPropertyDrawer propertyDrawerToUse) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:195)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorView.DrawInspectable (UnityEngine.UIElements.VisualElement outputVisualElement, UnityEditor.ShaderGraph.Drawing.IInspectable inspectable, UnityEditor.ShaderGraph.Drawing.IPropertyDrawer propertyDrawerToUse) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:140)
UnityEditor.ShaderGraph.Drawing.Inspector.InspectorView.Update () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Inspector/InspectorView.cs:126)
UnityEditor.ShaderGraph.Drawing.GraphEditorView.HandleGraphChanges (System.Boolean wasUndoRedoPerformed) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Views/GraphEditorView.cs:654)
UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Update () (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/MaterialGraphEditWindow.cs:342)
UnityEditor.HostView.SendUpdate () (at <0e11587263324259967daac4d577d226>:0)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <0e11587263324259967daac4d577d226>:0)

Some new tests and workarounds:

  • I’ve got a fresh install on a different machine behaving exactly the same way. Both on windows 10.
  • Both URP and HDRP projects show exact the same issue (tested with fresh HDRP template project).

I’ve been able to somewhat work around the issue by never clicking on any property node. For now, I can create a new property on subgraphs by creating an input node of the type I need, then right clicking the node > convert to > property. Still cannot rename the created property because that involves clicking (or right-clicking) on the property node, which throws the same error and prevents me from saving. Property nodes on top-level Shader Graphs do not present this issue.

Any updates on this bug?

Yeah it’s hard to work on subgraphs due to this bug. Here’s an issue tracker for another case other than this one.

I really wish they can get a fix in quickly for version 11 too.

I had a different issue from the bug report, but figured it would be worthwhile to mention here. My shader graphs were displaying pink and failing to save or compile with the text (nothing loaded) next to the name of the shader in the shader graph tab. I fixed it in my case by opening all of my sub-graphs and manually clicking “Save Asset,” which caused the contents to resave and reimport and fixed the “nothing loaded” problem with my main shaders.

I am not sure if the reason for this particular variation of the issue was related to version control and Unity not being able to write to those files during the import process, which would be a bug either way. But I was able to work around the problem with manually updating and saving the sub-graphs. Hope that helps someone!

Hi everyone, I got nearly a same issue :

I’ve created a project in a new project (same Unity version 2021.2.0f1, same ShaderGraph version 12.1.0) and create some shaders with shader graph.
Both project worked well.
I finished my second one and would like to merge it with the 1st one, so I’ve created a package.
Once I imported that one in my project all shadergraph where broken, unity can’t recognize them as shadergraph, asking me to find a software to open it.
I spend few days working on that and don’t understand what’s going on ?

Ok I got the issue, I’ve exported also the SceneExample from URP that make everything crashed. Once I’ve deleted that one everything goes well