Search Unity

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

Discussion in 'Shader Graph' started by UltraRobot, Jan 14, 2021.

  1. UltraRobot

    UltraRobot

    Joined:
    Dec 6, 2019
    Posts:
    30
    Having an issue with editing shadergraphs.

    I downloaded this toonshader sample from github:
    https://github.com/UnityTechnologies/open-project-1/tree/devlogs/1-toon-shading

    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:

    Code (CSharp):
    1.  
    2. ArgumentNullException: Value cannot be null.
    3. Parameter name: identifier
    4. UnityEditor.Undo.RegisterCompleteObjectUndo (UnityEngine.Object objectToUndo, System.String name) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
    5. UnityEditor.Graphing.GraphObject.RegisterCompleteObjectUndo (System.String actionName) (at Library/PackageCache/com.unity.shadergraph@10.2.2/Editor/Data/Implementation/GraphObject.cs:54)
    6. 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)
    7. UnityEditor.Experimental.GraphView.SelectionDragger.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at <ae0922aaaca441548dd02e17bb301e1c>:0)
    8. UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    9. UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    10. UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    11. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    12. UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    13. UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    14. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    15. UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    16. UnityEngine.UIElements.EventDispatcher.OpenGate () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    17. UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    18. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    19. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    20. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    21. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    22. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    23. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    24. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    25. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0)
    26.  
     
  2. MagdielM

    MagdielM

    Joined:
    May 27, 2020
    Posts:
    32
    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.
     
  3. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Have you got a bug report ID to hand?
     
  4. MagdielM

    MagdielM

    Joined:
    May 27, 2020
    Posts:
    32
    I believe it's case number 1304168.
     
  5. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Many thanks. I'll ask the team to get an update to you.
     
  6. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Just got this error and lost half a days work, did anything come of this. This is quite maddening.
     
  7. guischmitd

    guischmitd

    Joined:
    May 17, 2020
    Posts:
    2
    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.

    just_clicked.JPG

    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.

    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)
     
    479813005 and midsummer like this.
  8. guischmitd

    guischmitd

    Joined:
    May 17, 2020
    Posts:
    2
    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.
     
    garrettstrobel and xMako like this.
  9. haydenyeagley

    haydenyeagley

    Joined:
    Sep 15, 2020
    Posts:
    1
    Any updates on this bug?
     
  10. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
  11. Tristan-Moore

    Tristan-Moore

    Joined:
    Aug 22, 2014
    Posts:
    18
    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!
     
  12. DomeCreator

    DomeCreator

    Joined:
    Mar 5, 2020
    Posts:
    29
    Hi everyone, I got nearly a same issue :
    upload_2022-3-3_19-14-50.png

    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 ?
     
  13. DomeCreator

    DomeCreator

    Joined:
    Mar 5, 2020
    Posts:
    29
    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