---
title: GetAlphamapWeights(TerrainData, TerrainRegion, float, out RectInt)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityeditor/terraintools/terraineditutility/getalphamapweights
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityeditor/terraintools/terraineditutility/getalphamapweights.md
last_updated: 2026-10-20
generated_at: 2026-11-11T16:09:05.625Z
locale: en-us
---

# GetAlphamapWeights(TerrainData, TerrainRegion, float, out RectInt)

> Gets the weight that an edit of a region applies at each alphamap texel it covers.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.TerrainTools](/engine/7000.0/script-reference/unityeditor/terraintools.md)
* **Assembly:** UnityEditor

## GetAlphamapWeights(TerrainData, TerrainRegion, float, RectInt)

```csharp
public static float[,] GetAlphamapWeights(TerrainData terrainData, TerrainRegion region, float falloff, out RectInt texelRect)
```

### Parameters

**** (\[TerrainData]\(/engine/7000.0/script-reference/unityengine/terraindata)): The TerrainData whose alphamap grid to use.**** (\[TerrainRegion]\(/engine/7000.0/script-reference/unityeditor/terraintools/terrainregion)): The region.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The fraction of the region, from 0 to 1, over which the weight fades at its edge. See [TerrainRegion.GetWeight](/engine/7000.0/script-reference/unityeditor/terraintools/terrainregion/getweight.md).**** (\[RectInt]\(/engine/7000.0/script-reference/unityengine/rectint)): The rectangle of alphamap texels that the weights cover.

### Returns

| Type                                                               | Description                                                                                                                                                                                             |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [float\[,\]](https://learn.microsoft.com/dotnet/api/system.single) | The weights, from 0 to 1, indexed \[z, x] from the corner of `texelRect`, as [TerrainData.GetAlphamaps](/engine/7000.0/script-reference/unityengine/terraindata/getalphamaps.md) returns layer weights. |

### Remarks

These are the weights that [TerrainEditUtility.PaintLayers](/engine/7000.0/script-reference/unityeditor/terraintools/terraineditutility/paintlayers.md) applies with the same falloff: the region is widened to the alphamap texels it crosses in the same way, and texel (x, z) lies at (x, z) \* size / (alphamapResolution - 1). A texel with a weight of 0 lies outside the region. Read the layer weights of the same rectangle with [TerrainData.GetAlphamaps](/engine/7000.0/script-reference/unityengine/terraindata/getalphamaps.md).
