Canvas
Canvas Component is an abstract space for UI layout and rendering. All UI must be under this element (child object). Simply put, Canvas is the component that renders UI
Render Mode
There are three ways of UI rendering:
-
Screen Space – Overlay: screen space – overlay
-
Screen Space – Camera: Screen Space – Camera
-
World Space: world coordinate space
Screen Space – Overlay
In this mode, the Camera will not be referenced, and the UI will be displayed directly on top of any graphics
1.Pixel Perfect: It can make the image clearer, but there is additional performance overhead. If there are a lot of UI animations, the animation may not be smooth
2.Sort Order: Depth value, the higher the value, the more front the display
Screen Space – Camera
Use a Camera as a reference, and place the UI plane at a certain distance in front of the Camera. Because it is a reference to the Camera, the UI plane will be automatically resized when the screen size, resolution, and Camera viewing cone change. If the object (GameObject) in the Scene is closer to the camera than the UI plane, it will block the UI plane.
1.Render Camera: The camera used for rendering
2.Plane Distance: the distance from the Camera
3.Sorting Layer: The sorting layer that Canvas belongs to, add it in Edit->Project Setting->Tags and Layers->Sorting Layers, the lower the layer is displayed , the front
4.Order in Layer: The order under the sorting layer that Canvas belongs to, the higher the value, the more front the display
World Space