- Home /
Grass not showing after build
I generate terrain by script.
I have prefab (terrain with script).
In Start function load grass texture
detail0 = (Texture2D) Resources.Load("Image/Grass");
detailProtoTypes[0] = new DetailPrototype();
detailProtoTypes[0].prototypeTexture = m_detail0;
terrainData.detailPrototypes = m_detailProtoTypes;
Generate some grass:
int[,] detailMap0 = new int[m_detailMapSize,m_detailMapSize];
for(int x = 0; x < m_detailMapSize; x++) {
for (int z = 0; z < m_detailMapSize; z++) { detailMap0[z,x] = 0; if (something) { detailMap0[z,x] = 1; } } } terrain.terrainData.wavingGrassStrength = m_wavingGrassStrength; terrain.terrainData.wavingGrassAmount = m_wavingGrassAmount; terrain.terrainData.wavingGrassSpeed = m_wavingGrassSpeed; terrain.terrainData.wavingGrassTint = m_wavingGrassTint; terrain.detailObjectDensity = m_detailObjectDensity; terrain.detailObjectDistance = m_detailObjectDistance; terrain.terrainData.SetDetailResolution(m_detailMapSize, m_detailResolutionPerPatch); terrain.terrainData.SetDetailLayer(0,0,0,detailMap0);
So, and if i play run in unity editor, all grass textures show right. But if i build project and run exe file, grass not shoing.
I already tried to play with the settings import tried different textures, but nothing helped...
I have this same issue and I can't seem to find an answer to it anywhere. This happens weather or not I put the grass on with code or manually.
Your answer
![](https://koobas.hobune.stream/wayback/20220613151606im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Sprites missing on build 1 Answer
Changing lighting in-editor pre/post build 1 Answer
Why does my Unity Application crash only when it has been built? 0 Answers