Version: Unity 6 Preview (6000.0)
Language : English
Panels
Coordinate and position systems

Draw order

The draw order of elements in the visual treeAn object graph, made of lightweight nodes, that holds all the elements in a window or panel. It defines every UI you build with the UI Toolkit.
See in Glossary
follows a depth-first search. Child visual elementsA node of a visual tree that instantiates or derives from the C# VisualElement class. You can style the look, define the behaviour, and display it on screen as part of the UI. More info
See in Glossary
appear on top of parent elements. UI(User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary
Toolkit draws child elements in the order of the sibling list. The draw order is the following:

  1. The top visual element.
  2. The first child element of that visual element.
  3. The child elements of the descendant element.

The diagram below shows the draw order of a visual tree:

Visual element draw order
Visual element draw order

To change the draw order of visual elements in C#, use the following functions:

To change the draw order of sibling visual elements, use the following functions:

Panels
Coordinate and position systems