- Home /
HDRP Terrain Shader issues in Standalone Build Only
Using Unity 2020.1.5f1, in a standalone build, my terrain textures are showing up as whitish transparent, with objects seen through the terrain being magenta. The textures appear fine when playing in the Unity editor. I'm using the HDRP. The screenshot below shows what the terrain looks like in a build.
I am procedurally generating this terrain by creating a TerrainData object, setting it's parameters and terrain layers appropriately, using SetHeights() to set the generated heightmap, using SetAlphaMaps() to set the textures, then finally creating the terrain using Terrain.CreateTerrainGameObject(terrianData).
Things I have tried:
Added a non-procedural terrain to the scene with the same terrain layers as used in the procedural one. Its textures appeared fine in the build, but the procedural terrain still had the same visual error.
Loaded the terrain layer assets using addressables thinking that maybe the assets weren't being loaded for some reason, but still the same problem.
Added HDRP/TerrainLit to always included shaders, but caused unity to crash on build.
Does anyone have any insight on what to try next to resolve this issue? Thanks!
Answer by ThePilgrim · Sep 17, 2020 at 02:07 PM
I fixed it by assigning a material to the terrain during the generation that used the HDRP/TerrainLit shader. I just used the DefaultHDTerrainMaterial from the HDRP package. Apparently the terrain was trying to use the non HDRP terrain material.
Answer by Honda_Lau · Nov 29, 2020 at 11:39 AM
I have encountered the same problem as you. Could you please ask me how you solved it in detail? This problem has been bothering me for a long time