Game Development Reference
In-Depth Information
World Space : The other (and much more anticipated) view is to take your
Canvas and embed it within 3D worlds. This could be a TV screen, a
computer console, interactive conversation elements, or even an inventory
UI attached to the player. These scenarios were possible in the Legacy GUI;
however, they were difficult to manage and get the perspective just right .
Also, when text was used, scaling became a nightmare. All of this is so much
easier now with World Space Canvases.
The Canvas, however, is only part of the picture. To make these elements work in a
3D way, they need to work with Cameras in the scene, not just be a flat 2D surface
drawn on top of the screen, as with Screen Space - Overlay Canvases.
Cameras, when used with Canvases, fall into two categories:
• Rendering cameras
• Event cameras
Render cameras
In canvases, such as Screen Space - Camera , a second camera is used to render
the UI.
Actually, Screen Space - Overlay Canvases do this under the hood
but you don't get to control the camera settings; it is just another sprite
layer drawn in the scene.
The camera is used to provide the rendering settings for the UI. This is independent
of any other cameras in the scene, such as the Main Camera .
As such, they can be placed elsewhere in the scene (doesn't have to be in the same
place or direction as Main Camera ) with their own settings, such as the following:
Clear flags: : These choose which part of the rendering path should be cleared
(each frame)—this is set to Don't clear by default so that the UI is drawn on
top of the scene.
Culling Mask : This chooses what elements to draw in the view of the
camera—by default, this is set to UI only (it's recommended to keep it
this way).
Projection : Setting a Perspective (3D) or Orthographic view (2D) - This
should always be set to Perspective view, (which is the default) as an
Orthographic will only give you the same as a Screen Space - Overlay view.
 
Search WWH ::




Custom Search