Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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