# SetDepth(float, float)

> Sets the ContactFilter2D.minDepth and ContactFilter2D.maxDepth filter properties and turns on depth filtering by setting ContactFilter2D.useDepth to true.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public void SetDepth(float minDepth, float maxDepth)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value used to set [ContactFilter2D.minDepth](/engine/6000.0/script-reference/unityengine/contactfilter2d/mindepth.md).**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value used to set [ContactFilter2D.maxDepth](/engine/6000.0/script-reference/unityengine/contactfilter2d/maxdepth.md).
