Skip to content
zjy edited this page Jul 13, 2016 · 1 revision

uGUI

Canvas

Canvas

The Canvas is the area that all UI elements should be inside. The Canvas is a Game Object with a Canvas component on it, and all UI elements must be children of such a Canvas

Render Modes

  • Screen Space - Overlay
  • Screen Space - Camera
  • World Space

uiCamera

Draw order of elements

UI elements in the Canvas are drawn in the same order they appear in the Hierarchy. The first child is drawn first, the second child next, and so on. If two UI elements overlap, the later one will appear on top of the earlier one.

To change which element appear on top of other elements, simply reorder the elements in the Hierarchy by dragging them.

The order can also be controlled from scripting by using these methods on the Transform component: SetAsFirstSibling, SetAsLastSibling, and SetSiblingIndex.

drawOrder

参考:

宣雨松 uGUI 系列

Clone this wiki locally