Hello, I’m asking for help.
I’m trying to get a terrain elevation map and pass it to RenderTexture, but nothing comes out. I get the elevation map using “Terrain Data .heightmap Texture” in the help it says that it returns “public RenderTexture”, but the variable itself is not involved in the script.
public Terrain terrain;
public RenderTexture renderTexture;
private void Start() {
renderTexture = terrain.terrainData.heightmapTexture;
}
Nitpicky vocabulary: heightmapTexture is a property of TerrainData. It is public, so anyone can access it. It returns a value of type RenderTexture!
Anyway, I’m not really clear what the issue is here – you’re grabbing the render texture and storing it in a private variable, but you aren’t doing anything with it!
I’m guessing you want to use this render texture to draw a map. Are you having trouble getting it to draw correctly? What have you tried to do?
I’m trying to get the texture of the elevation (at the beginning of the scene). The help says that terraindada.heightmapTexture returns the texture of the height map. I tried to get this texture, and since the same help says that heightmapTexture is a public RenderTexture, I tried to assign it to it in the script.
Nothing happens (just a black color in the texture), and in the ide Rider shows that terrainData does not return anything, the RenderTexture variable is empty. So I’m trying to figure out why.