Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SortingCriteria

How to sort objects during rendering.
Read time 1 minuteLast updated 5 days ago

Definition

[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

BackToFrontSort objects back to front.
CanvasOrderSort renderers taking canvas order into account.
CommonOpaqueTypical sorting for opaque objects.
CommonTransparentTypical sorting for transparencies.
NoneDo not sort objects.
OptimizeStateChangesSort objects to reduce draw state changes.
QuantizedFrontToBackSort objects in rough front-to-back buckets.
RendererPrioritySorts objects by renderer priority.
RenderQueueSort by material render queue.
SortingLayerSort by renderer sorting layer.