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 Receiving Shader Errors on Build - URP - "Lit" Shader (v2021.3)

Discussion in 'Editor & General Support' started by RobDcomedy, May 21, 2023.

  1. RobDcomedy

    RobDcomedy

    Joined:
    May 19, 2019
    Posts:
    5
    Hello,

    I am received 2 errors when trying to build my project as follows:

    "Shader error in 'Universal Render Pipeline/Lit': maximum ps_4_0 sampler register index (16) exceeded at PC/Library/PackageCache/com.unity.render-pipelines.universal@12.1.10/ShaderLibrary/LightCookie/LightCookieInput.hlsl(12) (on d3d11)"

    AND

    "Shader error in 'Universal Render Pipeline/Lit': maximum ps_5_0 sampler register index (16) exceeded at PC/Library/PackageCache/com.unity.render-pipelines.universal@12.1.10/ShaderLibrary/LightCookie/LightCookieInput.hlsl(12) (on d3d11)"

    Upon inspecting my "Lit" shader, I noticed these 2 errors errors are actually listed on the shader itself under "Errors" under the Compiled Code button. In addition, the top section is greyed out (everything above "Imported Object") so I can't access the "Use Project Settings" dropdown

    This is causing random crashing in my game at the moment, but seemingly no issues in the editor itself, only on build. The project builds fully (with these two errors), and will generally launch and play for a few minutes, but then will crash without any kind of crash report or error message, just sort of closes out of nowhere.

    I tried deleting my Library folder and then reimporting everything, but that didn't solve the issue.

    Any help is appreciated

    -Rob