Search Unity

Resolved Undeclared identifier _BlendMode in HDRP 10.x / Material.hlsl:51

Discussion in 'High Definition Render Pipeline' started by dragon_slumber, Jan 15, 2021.

  1. dragon_slumber

    dragon_slumber

    Joined:
    Jun 11, 2017
    Posts:
    30
    Hey everyone,

    I have a shader that no longer works when I moved from Unity 2019.4 to 2020.2, due to changing the way Unity does "BlendMode". Specifically, Material.hlsl:51 requires a reference to "_BlendMode" in the shader, but despite adding that property it doesn't seem to recognize it. I'm not very knowledgeable with Shaders so I'm sure I didn't add the property in the right place, or maybe I didn't type it properly. If anyone could give me some indication of how to solve it, or show me a shader which implements it properly so I can look at that code, I'd be most grateful.

    Thank you,
    Kevin
     
  2. dragon_slumber

    dragon_slumber

    Joined:
    Jun 11, 2017
    Posts:
    30
    I finally solved the problem.Within my pass, I moved #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" to after "float _BlendMode;" and that did the trick.
     
    Atlas-terrain likes this.
  3. cathroon

    cathroon

    Joined:
    Apr 17, 2016
    Posts:
    1
    hi, i know this is like a full year later, but could you please provide an example of how you fixed this error? i don't know enough about shaders to solve it off of this description alone, and i'm unable to determine a solution from reading other documentation online.

    thank you!