Canvas (canvases)
The Canvas is the area for all UI elements to 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.
All UI elements will be placed in a place called canvas, canvas is a game object, it comes with a canvas game component, all UI Shu must be a canvas child object
When you create a new UI element, such as an Image using the menu gameobject > UI > Image, a Canvas is automatic Ally created too, if there isn ' t already a Canvas in the scene. The UI element is created as a child to this Canvas.
If you do not have a canvas in your scene, then when you create a new UI element, such as through a menu of game components >UI> Pictures, a common image, a canvas will be automatically generated because the UI element must be created as a child of the canvas .
The Canvas area was shown as a rectangle in the Scene View. This makes it easy-to-position UI elements without needing to has the Game View visible at all times.
Canvas is a rectangular area in the scene view, so you can easily and visually display UI elements at any time, even without the game view
Draw order of elements (the order in which UI elements are drawn)
UI elements in the Canvas is drawn in the same order they appear in the Hierarchy. The first child was drawn first, the second child next, and so on. If the UI elements overlap, the later one would appear on top of the earlier one.
The order in which UI elements are drawn in the canvas is the same as the order in which they appear in the hierarchy panel. The first child object is drawn first, the second sub-object is drawn second, and so on. If two UI elements are stacked in the same area, then the elements drawn above are drawn on top of each other.
To change which element appear on top of other elements, simply reorder the elements in the Hierarchy by dragging them. The order can also is controlled from scripting by using these methods on the Transform component:setasfirstsibling, SetA Slastsibling, and Setsiblingindex.
By simply dragging and dropping the order in the hierarchy panel, you can change the elements that appear in the topmost layer. You can also use the script to:
Setasfirstsibling, Setaslastsibling, and Setsiblingindex. This method sets the order in which UI elements are drawn.
Render Modes (render mode)
The Canvas has a render Mode setting which can is used to make it into the screen space or world space.
Canvas can be set to determine which elements can be rendered on screen space or world space by setting the rendering style.
Screen Space-overlay
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 would automatically change size to match as well.
This rendering is to render all UI elements at the top of the scene (like the film on the phone, all UI elements on the film), and if the screen size or resolution changes, the canvas will automatically go and adapt to the changed screen)
UI in the screen space overlay canvas (UI elements in the screen space render the effect overlay way)
Screen Space-camera
This was similar to-screen space-overlay, but in this render mode, the Canvas was placed a given distance in front of a SP Ecified Camera. The UI elements is rendered by this camera, which means, the camera settings affect the appearance of the UI. If the Camera is set to perspective, the UI elements would be rendered with perspective, and the amount of perspective dist Ortion can controlled by the Camera Field of View. If the screen is resized or changes resolution, or the camera frustrum changes, the Canvas would automatically change size To match as well.
This rendering is similar to screen space-overlay, but in this way the canvas is placed at a specific distance from a particular camera. The UI element is rendered by this camera, This means that the camera's settings affect the effect of the UI element. If the camera's projection is set to a projection graph (perspective), the UI element is also rendered through perspective, and the amount of distortion (distortion) of the perspective can be controlled by the camera's field of view ( If the size or resolution of the screen changes, or if the camera's Frustrum (??) Change, then canvas will adapt to this change.
UI in screen Space camera canvas (UI elements rendered via screen Space-camera)
World Space
This render mode makes the Canvas behave as any other object in the scene. The size of the Canvas can be set manually using its Rect Transform, and UI elements would render in front of or behind Oth Er objects in the scene based on 3D placement. This was useful for UIs that was meant to BES a part of the world, also sometimes referred to as diegetic interfaces.
This rendering makes the camera behave just like any other object in the scene view. The size of the canvas can be changed by manually changing its Rect transform component, UI elements are rendered before or after other objects based on their position in the 3D scene. This is useful for UI elements because it means that UI elements, like other game objects, become an ingredient in the game view, sometimes as diegetic (plot) interface
UI in the World space canvas (UI elements rendered by worldspace this way)
Ugui Learning (a) Canvas