Search Unity

Adding TerrainLit shader to "Always Included Shaders" causes crash when building a new URP project

Discussion in 'Editor & General Support' started by orville_redenbacher, Feb 9, 2021.

  1. orville_redenbacher

    orville_redenbacher

    Joined:
    Sep 9, 2018
    Posts:
    34
    Steps to reproduce:

    1) Create new project using Universal Render Pipeline template
    2) Add the TerrainLit (Universal Render Pipeline/Terrain/Lit) shader to Graphics -> Always Included Shaders
    3) Build for Windows or Android

    Is this expected? I'm trying to make sure the TerrainLit shader is included and used in one of my projects but the build process always crashes at "Compiling Scripts".
     
    Warmacha and FuriousEX like this.
  2. billw2011

    billw2011

    Joined:
    Apr 5, 2014
    Posts:
    15
    I have this exact same problem. My terrain is pink in the build, but fine in the editor, so I wanted to try this as a possible fix, but it causes the editor to hard exit during the build process with no crash report dialog.
    Did you find any fix for this?
     
  3. pfdaniel

    pfdaniel

    Joined:
    May 3, 2020
    Posts:
    14
    Any luck with this? we are running into the same issue
     
  4. orville_redenbacher

    orville_redenbacher

    Joined:
    Sep 9, 2018
    Posts:
    34
    I ended up assigning the correct material at runtime.

    Code (CSharp):
    1. Terrain t = FindObjectOfType<Terrain>();
    2. Material material = Resources.Load("TerrainLit", typeof(Material)) as Material;
    3. t.materialTemplate = material;
     
  5. jdh5259

    jdh5259

    Joined:
    Sep 14, 2017
    Posts:
    20
    Ran into this issue as well. We were able to create a shader variant collection for the TerrainLit shader to limit the variants and used that instead. It allowed us to build and appears to work as expected. That might be another alternative solution.
     
    orville_redenbacher likes this.