Canvas
Canvas应该包含全部UI元素,全部的UI元素应该时Canvas的子物体
调整元素的显示顺序可以从Hierarchy中直接拖拽他们,顺序从也可以被控制通过Scripting使用 SetAsFirstSibling, SetAsLastSibling, and SetSiblingIndex.这些方法。
RenderModes
- Screen space - Overlay:
这个模式,UI将渲染在screen的最上层
This render mode places UI elements on the screen rendered on top of the scene. If the screen is resized or changes resolution, the Canvas will automatically change size to match this. - Screen Space - Camera :
这个模式类似于Overlay,但是Canvas被放置在一个Camera前面一定距离,UI将通过camera进行渲染,相机的渲染效果将影响UI的表现,如果相机是透视视角,UI将被渲染成透视效果
This is similar to Screen Space - Overlay, but in this render mode the Canvas is placed a given distance in front of a specified Camera. The UI elements are rendered by this camera, which means that the Camera settings affect the appearance of the UI. If the Camera is set to Perspective, the UI elements will be rendered with perspective, and the amount of perspective