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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Unity 2022.2 URP Shadows.hlsl Error

Discussion in 'Shaders' started by adamgryu, Jan 25, 2023.

  1. adamgryu

    adamgryu

    Joined:
    Mar 1, 2014
    Posts:
    171
    I recently updated from 2021 to 2022, and my custom shaders no longer work. I receive this error.

    Shader error in 'Custom/Toon/Toon Water': Invalid conditional expression. at .../Library/PackageCache/com.unity.render-pipelines.universal@14.0.5/ShaderLibrary/Shadows.hlsl(270)


    The offending line of code in Shadows.hlsl looks like this:
    upload_2023-1-24_20-26-14.png
    It looks like a syntax error since #if is used instead of #ifdef - however, there surely can't be a syntax error in the official URP code?

    I've seen a few threads that seem to suggest the shader preprocessor syntax may have changed - am I missing something here?
     
    Last edited: Jan 25, 2023
  2. scottjdaley

    scottjdaley

    Joined:
    Aug 1, 2013
    Posts:
    152
    I'm seeing the same problem in URP 14.0.4 and 14.0.6
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,519
    And in 14.0.6 here, too.
     
  4. michael_unity145

    michael_unity145

    Joined:
    Mar 8, 2022
    Posts:
    21
    Just upgraded to Unity 2022.3.2f1 and URP to 14.0.8 and getting this syntax error as well in Shadows.hlsl line 262. Wtf?
     
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,519
    I reported it after my last post and it was confirmed as a bug on their end. Hopefully tbe fix makes it out soon.
     
    michael_unity145 likes this.
  6. NymThePseudo

    NymThePseudo

    Joined:
    Oct 12, 2014
    Posts:
    4
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,519
    Yeah, pretty sure I got an update saying it'd been fixed for 2023. It's the kind of thing you'd really hope would be addressed in the LTS, though.