- Home /
Question by
ah311066ha · Nov 25, 2020 at 05:27 AM ·
terrainterraintextureterrains
how to chande terrain layer texture during runtime,how to change terrain layer diffuse texture in runtime?
My english is bad
So I am making a little farm game in Unity
Im trying to change the texture during runtime with C# scripts ( I marked in the picture )
I have search the answer on google
However they did't fit my need I dont know how to access the diffuse texture , can someone help me?
未命名.png
(94.4 kB)
Comment
Answer by Elharter · Jan 19, 2021 at 04:51 PM
This is your answer:
TerrainLayer[] tlayers = Terrain.activeTerrain.terrainData.terrainLayers; tlayers[0].diffuseTexture = texture; // = 0 is the first layer in the list of layers / array
greetings