Home > other >  Recommendation: reproduced uGUI Canvas, Canvas _Unity3d development technology
Recommendation: reproduced uGUI Canvas, Canvas _Unity3d development technology

Time:09-24

original: [uGUI] Canvas - Canvas _Unity3d development technology http://blog.csdn.net/ios_song/article/details/52181763 want to see the image contrast, can go to the blog to see!

?? One of Unity can intuitively and quickly build the user interface UI system, we call it the uGUI,

UGUI

?? In uGUI, Canvas is a game in the mount of Canvas component object, it drew a area, used to hold all the UI elements, and these UI elements must be Canvas child objects,

?? When we create a new UI elements, if no Canvas, in the scene will automatically create a Canvas,

?? Canvas will be in the Scene view shows a rectangular area, it can make us without running the project cases, direct visually positioning UI elements in the Scene view,



Elements of the drawing order
?? UI elements in Canvas drawing order, and they appear in the view hierarchy of the same order, Canvas first child object will be the first to be drawn, then the second child object, by analogy, if the two overlapping UI elements, so after drawing elements will overwrite a first drawing element,

?? If you want to change some UI elements drawing order, just by dragging to sort elements in the view hierarchy, drawing order can also be through script to control, need to use the Transform component of three methods: SetAsFirstSibling, SetAsLastSibling and SetSiblingIndex,



Render Mode - rendering Mode
?? Render Mode Settings in the Canvas, rendering is used to determine it to screen space to world space rendering, there are three set way,

1, Screen Space - Overlay

?? This rendering mode will render the UI elements on the screen in the scene at the top, if the screen size or resolution is changed, Canvas will automatically change the size, and screen keeps consistent,



Screen Space - Overlay

2, the Screen Space - Camera

?? The render mode and the Screen Space - similar to Overlay, in this mode, Canvas is specified in the front of the camera, the distance can be adjusted, the UI elements through the camera to rendering, the camera Settings will affect the appearance of the UI, if the camera set to perspective, the UI elements will render the perspective, and perspective of variables can be controlled by the camera's Field of View, if the Screen size or resolution is changed, or the camera cone changed, Canvas will change size at the same time, and the Screen keeps consistent,



Screen Space - Camera

3, the World Space

?? Render in this mode, the Canvas, and other game objects in the scene, the size of the Canvas can be manually set by RectTransform and UI elements according to is placed in the 3 d scene to render behind or in front of the other objects in the scene, when we want to make the UI is very useful when part of the world scene, it is also known as "the narrative Interface (Diegetic Interface)",

  • Related