Documentation

Unity Engine

Unity Engine

alphamapResolution

The size of the alpha map in texels for either the width or the height.
Read time 1 minuteLast updated a month ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.TerrainModule
public int alphamapResolution { get; set; }

Remarks

Setting this value, even to its current value, resizes the alpha map textures and resets all splat weights: the first terrain layer gets a weight of 1 everywhere and the other layers get 0. To keep existing painting, read the weights with TerrainData.GetAlphamaps before you change the resolution, resample them to the new size, and write them back with TerrainData.SetAlphamaps. To make the change undoable from an Editor script, register both the TerrainData and its TerrainData.alphamapTextures with
Undo.RegisterCompleteObjectUndo
before you set this value.