Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Terrain GetHeights, SetHeights, SetHeightsDelayLOD and TerrainAPI

Discussion in 'World Building' started by sqallpl, Jul 23, 2019.

  1. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    228
    Hi,

    I'm looking into implementing some TerrainAPI features but at the moment we are still using SetHeights for terrain modification, especially for sticking terrain heightmap to meshes.

    I wanted to test SetHeightsDelayLOD because it's faster than SetHeights.
    Documentation says that Terrain.ApplyDelayedHeightmapModification should be called after SetHeightsDelayLOD but it's obsolete at the moment (https://docs.unity3d.com/ScriptReference/Terrain.ApplyDelayedHeightmapModification.html).

    Should I call TerrainData.SyncHeightmap after SetHeightsDelayLOD or maybe something else to force the update? Or maybe the update is not required anymore after using SetHeightsDelayLOD?

    BTW. Do you plan to keep or remove TerrainData GetHeights, SetHeights or SetHeightsDelayLOD in the future?
     
    Last edited: Jul 24, 2019
  2. ChrisTchou

    ChrisTchou

    Unity Technologies

    Joined:
    Apr 26, 2017
    Posts:
    65
    sqallpl likes this.
  3. ChrisTchou

    ChrisTchou

    Unity Technologies

    Joined:
    Apr 26, 2017
    Posts:
    65
    Also, yes, GetHeights/SetHeights/SetHeightsDelayLOD will continue to exist as the way to modify the heightmap via CPU code. You may get better performance though by using the GPU route, depending on what you are doing.
     
    sqallpl likes this.