Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


alphamapTextures

Alpha map textures that store the splat weights of the terrain layers.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.TerrainModule
public Texture2D[] alphamapTextures { get; }

Remarks

Each texture stores four layers, one per RGBA channel. The textures are separate Texture2D objects. Unity adds them to the TerrainData asset as sub-assets only if the TerrainData is already an asset when they are created, so save a new TerrainData as an asset before you assign terrain layers. To make a change to the weights from an Editor script undoable, for example with TerrainData.SetAlphamaps, register both the TerrainData and these textures with
Undo.RegisterCompleteObjectUndo
before the change. If you register only the TerrainData, undo does not restore the weights.