Grass Removal at building position

I have been researching this for a while and can’t find a solution!

I am looking to remove the grass on the terrain at a certain location where a building is placed.

In runtime I am using a building placement system however the grass on the terrain goes through the floor.

When the object is placed I want the grass on the terrain to be removed at that certain point.

Any help would be much appreciated as i have no clue!


Use Terrain.activeTerrain.terrainData to get the object that contains all relevant data of your terrain. TerrainData has a method GetDetailLayer to read a detail layer and a method SetDetailLayer to write it. The detail layer is represented by a 2D integer array where each entry is the number of detail objects at those coordinates.