# SetLayerCost(int, float)

> Sets the cost for traversing over geometry of the layer type.

## Definition

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

> **Warning:**
>
> **Deprecated.** Use SetAreaCost instead.

```csharp
public void SetLayerCost(int layer, float cost)
```

### Parameters

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

### Remarks

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