There are four kinds of objects we see when playing a game:
- GameObjects that have some visual elements, such as 2D and 3D objects.
- UI elements located in World Space, so they appear next to GameObjects in the scene.
- UI elements located in Screen Space - Camera, so they appear at a fixed distance from the camera (but can be obscured by GameObjects closer to the camera than these UI elements).
- UI elements located in Screen Space - Overlay. These always appear above the other three kinds of visual elements and are perfect for Heads-Up Display (HUD) elements, such as inventories.
Sometimes, we want to visually make it clear which elements are part of the UI HUD and which are visual objects in the scene. Using Unity UI Panels, along with an opaque or translucent background image, is a simple and effective way to achieve this:
Figure 3.18 – Example of using Unity UI Panels
Panels can also...