Search Unity

Bug unity_LightmapST missing

Discussion in 'Universal Render Pipeline' started by stroibot, Sep 7, 2022.

  1. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    Hi,

    After I updated my project from 2021.3.0 to 2021.3.9 and URP package updated from 12.1.6 to 12.1.7 and now I get shader compilation error and my materials are broken:
    Shader error in 'filename': undeclared identifier 'unity_LightmapST' at /UnityProjects/project/Library/PackageCache/com.unity.render-pipelines.core@12.1.7/ShaderLibrary/MetaPass.hlsl(81) (on d3d11)


    What do I do?
     
  2. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    Anyone?
     
  3. peterbay

    peterbay

    Unity Technologies

    Joined:
    Nov 2, 2017
    Posts:
    100
    Which shader are you getting this error from?
     
  4. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    In my shader, but there was no error before update, so the only way of fixing it that I see is downgrading. The strange thing.

    The strange thing is it says that there's error in my shader, but this line confuses me
    undeclared identifier 'unity_LightmapST' at /UnityProjects/project/Library/PackageCache/com.unity.render-pipelines.core@12.1.7/ShaderLibrary/MetaPass.hlsl(81) (on d3d11)


    Like, this is a package.

    Is there was some API changes?
     
  5. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    Clearing library, package cache and reimporting didn't helped me.
     
  6. peterbay

    peterbay

    Unity Technologies

    Joined:
    Nov 2, 2017
    Posts:
    100
    By "my shader", do you mean a custom shader? It sounds like you're missing an include somewhere. Did you base the shader off one in URP?
     
  7. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    Custom URP shader, yes, sorry. But why do I need to add it now?
     
  8. peterbay

    peterbay

    Unity Technologies

    Joined:
    Nov 2, 2017
    Posts:
    100
    Hard to say exactly why without knowing what's in your shader. I would guess that a change landed in a pass file that you're including which made it depend on something our own shader already included, but your shader didn't. Hopefully, we'll have a better way to do custom shaders in the future.

    As for what you need to do, the undeclared identifier is declared in "com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl". But rather than directly including that one, I would recommend that you ensure that you're including "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" before the pass file. That one also includes UnityInput.hlsl, as well as a bunch of stuff used in URP.