SortingCriteria
How to sort objects during rendering.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Enum
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
[Flags]public enum SortingCriteria
Remarks
Control the way Unity sorts objects before drawing them by using and combining these flags.
The basic flags are:
Multiple flags, when combined, are applied in the above order.
Some commonly-used sorting combinations are provided for convenience. Use SortingCriteria.CommonOpaque for opaque objects. This combination of flags includes optimization for reducing draw state changes and draws roughly front-to-back to reduce drawing over the same pixels many times. Use SortingCriteria.CommonTransparent for transparent objects, which need to be sorted from back to front before being drawn for them all to be visible.
Additional Resources: sorting, ScriptableRenderContext.DrawRenderers.
Fields
Value | Description |
|---|---|
| BackToFront | Sort objects back to front. |
| CanvasOrder | Sort renderers taking canvas order into account. |
| CommonOpaque | Typical sorting for opaque objects. |
| CommonTransparent | Typical sorting for transparencies. |
| None | Do not sort objects. |
| OptimizeStateChanges | Sort objects to reduce draw state changes. |
| QuantizedFrontToBack | Sort objects in rough front-to-back buckets. |
| RendererPriority | Sorts objects by renderer priority. |
| RenderQueue | Sort by material render queue. |
| SortingLayer | Sort by renderer sorting layer. |