# SetAreaCost(int, float)

> Sets the cost for traversing over areas of the area type.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.AI](/engine/6000.5/script-reference/unityengine/ai.md)
* **Assembly:** UnityEngine.AIModule

```csharp
public void SetAreaCost(int areaIndex, float areaCost)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Area cost.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): New cost for the specified area index.

### Remarks

If you enable or disable the agent then the cost will be reset to the default layer cost.
