# SetLayerCost(int, float)

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

## Definition

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

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

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

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Remarks

This will replace any custom layer costs on all agents.
