How to Modify Terrain at Runtime

Hi,

First I have to say that I’m totally new to unity, and I’m experimenting with the features.

Anyone has experience with modifying/creating terrain at runtime? What are the steps to perform this operation?

Thanks a lot for spending the time to drop a few a lines on this topic :slight_smile:

thanks,
Mytch

hi
it’s easy to modify the terrain at runtime
just you should choose some vertecies and then modify their height and apply changes

this function will create a new terrain for you

you can set the height of a terrainData object with this

each terrain has a terrainData propertie
you should modify the terrainData’s heightmap to modify it’s height.
the setHeightMap function get the starting x and y position of modification area and an array of floats that it’s width and height wil determine the width and height of the modification area

read the Unity - Scripting API: Terrain page carefully

1 Like