Search Unity

Bug Shader Sub Graph not working (URP)

Discussion in 'Shader Graph' started by ZigZagZat, Mar 31, 2021.

  1. ZigZagZat

    ZigZagZat

    Joined:
    Mar 6, 2021
    Posts:
    12
    On version 2021.1.0f1 whenever I try to create and drag in a property on a Shader Sub Graph I get this error:

    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)
     

    Attached Files:

  2. MadLab_TR

    MadLab_TR

    Joined:
    Jan 4, 2019
    Posts:
    2
    Up +1
     
    Filimindji likes this.
  3. MadLab_TR

    MadLab_TR

    Joined:
    Jan 4, 2019
    Posts:
    2
    Some problem for me. Unity version 2021.1.0f1. I created subgraph and when I try add new property or edit some properties I take this error :

    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() (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:327)

    After take this error, shader graph doesn't work properly, drag drop system is working incorrectly and I can't add new nodes to subgraph

     
  4. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    same here. hdrp. anyone find a workaround?
     
  5. belerion4830

    belerion4830

    Joined:
    Oct 12, 2019
    Posts:
    1
    As workaround, I currently has ongoing project in 2021.1.1f1 and temporary project in 2020.3.2f1.
    1) create whole shader graph in 2021.1
    2) copy graph to 2020.3
    3) add all needed properties and connection to nodes in 2020.3
    4) copy graph back to 2021.1
    But yeah, issue is really annoying and need a fix
     
  6. Lightway_

    Lightway_

    Joined:
    Dec 20, 2019
    Posts:
    3
    I create shader subgraph. Add float property, add float property. Drag input property to graph sheet...

    2021.1.0b11


    ArgumentNullException: Value cannot be null.
    Parameter name: identifier
    UnityEditor.Undo.RegisterCompleteObjectUndo (UnityEngine.Object objectToUndo, System.String name) (at <9f62394378254de0b0854a31bffc99b8>:0)
    UnityEditor.Graphing.GraphObject.RegisterCompleteObjectUndo (System.String actionName) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Data/Implementation/GraphObject.cs:54)
    UnityEditor.ShaderGraph.Drawing.MaterialGraphView.CreateNode (System.Object obj, UnityEngine.Vector2 nodePosition) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Views/MaterialGraphView.cs:1138)
    UnityEditor.ShaderGraph.Drawing.MaterialGraphView.OnDragPerformEvent (UnityEngine.UIElements.DragPerformEvent e) (at Library/PackageCache/com.unity.shadergraph@11.0.0/Editor/Drawing/Views/MaterialGraphView.cs:1019)
    UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <26a8b3f464c04cf88ca0dd94dd27ee12>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <9ff04fda545c4aacb8dab659ad40b2f4>:0)



    And

    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 <9f62394378254de0b0854a31bffc99b8>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <9f62394378254de0b0854a31bffc99b8>:0)
     
  7. sabint

    sabint

    Joined:
    Apr 19, 2014
    Posts:
    26
    Bump, ran into this as well.
    This needs a fix asap and perhaps also be gated behind a test before release.
     
    dr4 and Filimindji like this.
  8. HitsuSan

    HitsuSan

    Joined:
    Sep 28, 2014
    Posts:
    158
    It does the same exact thing in HDRP on 2021.1.0f up until .2f. I'm going to test other versions as well cause it's hindering our work like this.
     
  9. rootools

    rootools

    Joined:
    Nov 25, 2013
    Posts:
    20
  10. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Tested in 2021.2.0a15, no issues - created subgraph, added property, dragged into graph, connected to output, saved it.
     
  11. rootools

    rootools

    Joined:
    Nov 25, 2013
    Posts:
    20
    What URP version on 2021.2.0a15?
     
  12. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Package Manager shows 12.0.0 (April 21, 2021)
     
    rootools likes this.
  13. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    148
    Bump, same here @ 2021.1.5f1 with HDRP
     
  14. HitsuSan

    HitsuSan

    Joined:
    Sep 28, 2014
    Posts:
    158
    As far as i can tell it doesn't seem connected with URP or HDRP, it must be something in shadergraph standard but it's good that it seems to be solved in 2021.2.0

    The problem is still present on 2021.1.5f

    In the mean time I've created an empty project on 2020 lts to make my subgraph and shaders and they all work with zero problems
     
  15. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,383
    Same issue 2021.1 and SG 11... How is it possible that issues with super basic operations like this make it into a released Unity version in a package that is marked as 'Release'... These past few shader graph versions I have nothing but issues with basic simple things that don't work. So what is the solution? Move to 2021.2 and maybe get even more bugs?

    Version 10 and 11 of SG have been so unstable that I'm unable to work with them.
     
  16. m360p

    m360p

    Joined:
    Jul 18, 2016
    Posts:
    3
    Having the same issue in 2021.1.1f1. I can't even progress further because of this issue...
     
  17. HitsuSan

    HitsuSan

    Joined:
    Sep 28, 2014
    Posts:
    158
    still broken in 2021.1.6f
     
  18. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
  19. Skyler_Hawkins

    Skyler_Hawkins

    Joined:
    Aug 18, 2016
    Posts:
    32
    I was just having this probable with 2021.1.4

    I just Updated to 2021.1.7 and has fixed this problem for me.

    However, I can't add any other notes after I add my owe Properties..... This is dumb
     
  20. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    2021.1.7, from limited tests, seems to have fixed this problem. I can add nodes after adding properties without errors. Can others try also?
     
  21. nicolanore

    nicolanore

    Joined:
    Aug 31, 2016
    Posts:
    1
    I confirm that it it fixed in 2021.1.7.
    I had the problem with 2021.1.6, and it started working when I installed 2021.1.7.
     
    alexanderameye and Korindian like this.
  22. drknssflame

    drknssflame

    Joined:
    May 8, 2019
    Posts:
    1
    ^ Just changed mine from 2021.1.4 to 2021.1.10, can confirm that issue at least went away.
     
  23. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
    having the issue in 2021.1.1f1
     
  24. Ziflin

    Ziflin

    Joined:
    Mar 12, 2013
    Posts:
    132
    For those that come here looking for a NullReferenceException in 2021.2.6f1 in UnityEditor.ShaderGraph.ShaderSubGraphImporter, it seems to be caused by having a (boolean) "Keyword" in the subgraph. This causes a 'null' entry to be added to the orderedProperties array which results in a NullReferenceException father down. (This appears to be caused by the recent addition of property 'categories'.)

    This is using Shader Graph 12.1.2 with all packages up to date. If I delete the keyword, the crash does not occur, but we need the keyword, and it worked fine in the previous version we were using.

    Most annoyingly (despite most of our scenes now being colored gray), when this occurs it will cause all connections in the parent graph to the sub-graph to be lost (input and output) which can be extremely irritating when you have 16+ connections to reconnect. I'm about to submit a bug to Unity for this since I don't see one.
     
  25. azganmtgo

    azganmtgo

    Joined:
    May 3, 2020
    Posts:
    12
    I just experienced this annoying problem in 21.2.3 thanks for saving me time trying to upgrade to .6 <3
     
  26. Ziflin

    Ziflin

    Joined:
    Mar 12, 2013
    Posts:
    132
    @azganmtgo Yeah, I'm not sure how this one has slipped past 6 patches since 2021.2.0f1, but I posted a bug about it yesterday. Hopefully they'll get to it soon as we're stuck on 2021.2 beta until it's fixed.
     
  27. azganmtgo

    azganmtgo

    Joined:
    May 3, 2020
    Posts:
    12
    I've seen some gibberish in the URP 13.0 Do you reckon its fixed in 2022?
     
  28. l3kim

    l3kim

    Joined:
    Mar 7, 2020
    Posts:
    6
    I've also posted a bug. Any suggestions on workaround until then? It seems if i just don't use the boolean keyword in a subgraph I can get the shader to work, but that's not ideal.
     
  29. alb-lab

    alb-lab

    Joined:
    Feb 2, 2019
    Posts:
    11
    Just found this same error. I have some old subgraphs with a boolen keyword in them and I can't edit them anymore in Unity 2021.2.7.
    Please, can you link the bug report on Issue Tracker so that I can upvote it ?
     
  30. Jar_Coding

    Jar_Coding

    Joined:
    Oct 5, 2017
    Posts:
    17
    Its fixed in 2021.2.8. But looks like now keywords in subgraphs are not included in builds :(