Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

TerrainData.alphamapResolution

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public int alphamapResolution;

Description

The size of the alpha map in texels for either the width or the height.

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.