Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Shader Graph_SearchWindowProvider: Create node causes null reference exception error

Discussion in 'Shader Graph' started by Meta_Bird, Jan 25, 2023.

  1. Meta_Bird

    Meta_Bird

    Joined:
    Apr 25, 2020
    Posts:
    15
    Hi,

    I have recently started getting a null reference exception error when trying to add nodes to shader graph.

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.ShaderGraph.Drawing.SearchWindowProvider.GenerateNodeEntries () (at ./Library/PackageCache/com.unity.shadergraph@14.0.5/Editor/Drawing/SearchWindowProvider.cs:79)

    Line 79:
    Code (CSharp):
    1. bool hideCustomInterpolators = m_Graph.activeTargets.All(at => at.ignoreCustomInterpolators);
    2.  
    This is consistently occurring when trying to use the space bar shortcut and regularly occurring when using right click > create node. Sometimes restarting shader graph or unity seems to temporarily resolve the issue.

    I've not touched Shader Graph package code. Is this a bug?

    I am using:
    • Unity 2022.2.3f1
    • URP 14.05
    • Shader Graph 14.05

    The full console print:
    upload_2023-1-25_17-43-28.png
     
    scottjdaley likes this.
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687
    I have this issue as well on 14.04. Not sure what causes it. I can close and then reopen the graph, but the bug always comes back, making Shader Graph nearly unusable.
     
  3. Createman

    Createman

    Joined:
    Apr 14, 2013
    Posts:
    16
    I also have this issue.

    Play mode might be causing this.
    I also noticed that the Fullscreen options are missing from the Game window in this version.

    Weirdly, sometimes it's only the spacebar that triggers this bug, not the right mouse button menu.
    • Unity 2022.2.4f1
    • URP 14.05
    • Shader Graph 14.05
     
    Last edited: Jan 31, 2023
  4. Createman

    Createman

    Joined:
    Apr 14, 2013
    Posts:
    16
    Downgraded Unity and now everything is working:
    • Unity 2022.2.0f1
    • URP 14.04
    • Shader Graph 14.04
    Also, the Game window has Fullscreen options again in this downgraded version. (And there is Display Settings tab in Preferences).
     
  5. Meta_Bird

    Meta_Bird

    Joined:
    Apr 25, 2020
    Posts:
    15
    Good to know that it is not just me.

    Yes, I'm finding that it is specifically exiting play mode that seems to trigger the issue. I can edit the graph during play mode but as soon as I exit play mode I consistently get the null reference exception.
     
    Last edited: Jan 31, 2023
    asus4 likes this.
  6. asus4

    asus4

    Joined:
    Dec 7, 2012
    Posts:
    5
    Meta_Bird and jRocket like this.
  7. EyeDev44

    EyeDev44

    Joined:
    Apr 8, 2017
    Posts:
    140
    Same, 2022.2.6
     
    Meta_Bird likes this.
  8. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    656
    I get this a lot in 2022.2.8f1 as well (I think it started in 2022.2.5f1)
    It's not a 100% repro, and seems to relate to which objects are selected.

    Workaround is to close and reopen the graph, one or two steps of work as well as the view positon will be lost even if you save on closing, which makes this quite jarring.

    I tried to fiddle with searcher features, but to no avail. They seem to be unrelated, despite the name. So some more defensive programming here would be much appreciated, a single activeTarget that becomes null must never soft-lock the user out of any meaningful interaction with the entirety of ShaderGraph.

    I'm considering working around the issue by adding some exception handling to the crashing code, but rolling custom RP package is always a hassle.

    Edit: In fact, the patch would be in the ShaderGraph package, but I can't turn that into a custom package for some magical reason (totally breaks all shadergraphs, won't reimport). Would be offtopic, but moving this to Packages from Package Cache doesn't work, which is weird. Aren't packages supposed to be, you know, like packages?

    Edit2: Had to reimport all shadergraphs that were DefaultAssets now for some reason, then reimport all custom subgraphs from another package, and then all of my shadergraphs again.
     
    Last edited: Mar 2, 2023
  9. asus4

    asus4

    Joined:
    Dec 7, 2012
    Posts:
    5
    Meta_Bird likes this.