Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Shader Graph null ref in HDRP when setting Material Type, causes graph to crash

Discussion in 'Unity 6 Beta' started by Churd, Jan 25, 2024.

  1. Churd


    Dec 12, 2015

    THIS IS FIXED IN 2023.3.0b5


    In a HDRP Lit Shader Graph, when changing Material Type in the Surface Options, it throws a null reference exception and the graph window immediately closes. Adding new material types, such as subsurface scattering, translucency, etc, is not possible, because the graph closes immediately, preventing you from saving the change.

    To reproduce the error, simply create a new HDRP Lit Shader Graph, and then try to change the Material Type.

    Code (CSharp):
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UnityEditor.ShaderGraph.Drawing.GraphEditorView.<.ctor>b__57_14 () (at ./Library/PackageCache/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs:272)
    4. UnityEditor.ShaderGraph.Drawing.MaterialGraphView.ChangeTargetSettings () (at ./Library/PackageCache/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs:133)
    5. UnityEditor.ShaderGraph.Drawing.Inspector.PropertyDrawers.GraphDataPropertyDrawer+<>c__DisplayClass10_0.<CreateGUI>b__0 () (at ./Library/PackageCache/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/GraphDataPropertyDrawer.cs:263)
    6. UnityEditor.Rendering.HighDefinition.ShaderGraph.SubTargetPropertyBlock+<>c__DisplayClass10_0`1[Data].<AddProperty>b__1 (UnityEngine.UIElements.ChangeEvent`1[T] evt) (at ./Library/PackageCache/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs:90)
    Last edited: Feb 2, 2024
    eggsamurai and jaquanjjrice2233 like this.
  2. laurentlavigne


    Aug 16, 2012
    you can change the tag of your post to <resolved>