# DepthState(bool, CompareFunction)

> Creates a new depth state with the given values.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine.Rendering](/engine/6000.7/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public DepthState(bool writeEnabled = true, CompareFunction compareFunction = CompareFunction.Less)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Controls whether pixels from this object are written to the depth buffer.**** (\[CompareFunction]\(/engine/6000.7/script-reference/unityengine/rendering/comparefunction)): How should depth testing be performed.
