# DistanceMetric

> Type of sorting to use while rendering.

## Definition

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

```csharp
public enum DistanceMetric
```

## Remarks

By default, perspective cameras sort objects based on distance from camera position to the object center; and orthographic cameras sort based on distance along the view direction.

If you're making a 2D game with a perspective camera, you might want to use [DistanceMetric.Orthographic](/engine/6000.6/script-reference/unityengine/rendering/distancemetric/orthographic.md) sort mode so that objects are sorted based on distance along the camera's view direction.

## Fields

| Value                                                                                                | Description                                         |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| [CustomAxis](/engine/6000.6/script-reference/unityengine/rendering/distancemetric/customaxis.md)     | Sort objects based on distance along a custom axis. |
| [Orthographic](/engine/6000.6/script-reference/unityengine/rendering/distancemetric/orthographic.md) | Orthographic sorting mode.                          |
| [Perspective](/engine/6000.6/script-reference/unityengine/rendering/distancemetric/perspective.md)   | Perspective sorting mode.                           |
