Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug [IN-16080] Shader error in 'Shader Graphs/': '#': output parameter '#' not completely initialized

Discussion in 'Universal Render Pipeline' started by ROBYER1, Sep 9, 2022.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Bug report case id: IN-16080 - [URP] Build & Run - Shader error in 'Shader Graphs/glTF-unlit': '#': output parameter '#' not completely initialized

    I tried to search this up a while ago but couldn't find anyone talking about this issue so I thought I would talk about it here to see if anyone else ever found this and to help others!

    When using a custom function node in a shader taken from this blog post for getting a light source in shader for custom shadows (https://chulin28ho.tistory.com/690#google_vignette), using a build & run causes the build to error about 'Shader error in 'Shader Graphs/glTF-unlit': 'CustomLight_float': output parameter 'Direction' not completely initialized at Assets/Shaders/UnlitReceiveShadow/CustomLight_float.hlsl(5) (on d3d11)'

    Error:
    Code (CSharp):
    1. Shader error in 'Shader Graphs/glTF-unlit': 'CustomLight_float': output parameter 'Direction' not completely initialized at Assets/Shaders/UnlitReceiveShadow/CustomLight_float.hlsl(5) (on d3d11)
    Error2:
    Code (CSharp):
    1. Error building Player: Shader error in 'Shader Graphs/glTF-unlit': 'CustomLight_float': output parameter 'Direction' not completely initialized at Assets/Shaders/UnlitReceiveShadow/CustomLight_float.hlsl(5) (on d3d11)
    This only happens when doing a build & run and not when doing a build, doing a build only runs fine. Also if you have done a build successfully then do a build & run on top of it, it works without the error.

    To explain what is happening, we are using the GLTFast package (https://github.com/atteneder/glTFast), copied it from Library/PackageCache to Packages folder so we can edit it locally - edited glTFast/Runtime/Shader/glTF-unlit shader graph to add custom shadow receiving via the custom function node mentioned above in Shader Graph. I have attached a zip of the shader graph and custom function .hlsl as a zip here so you can repro this without using GLTFast package.

    In Project Settings > Graphics you should save a Shader variant collection from the scene so only the required shader variants are preloaded for the build.

    This issue happens in 2022.1.4f1, 2022.1.15f1, 2022.2.0b6 beta and 2022.2.0b7 beta
     

    Attached Files: