Game Development Reference
In-Depth Information
°
Event Camera
(
World Space only
): This identifies which camera
should be used to render and receive events on (same as the
Render
Camera
for
Screen Space
-
Camera
).
°
Sorting Layer
(
Screen Space - Camera
and
World Space only
): When
the Canvas is used with other Sprite Rendering components in a
scene (such as the 2D rendering system and Sprites), this sets which
Sprite
Sorting Layer the canvas renders on.
°
Order in Layer
(
Screen Space - Camera
and
World Space only
):
The draw order on the selected Sprite
Sorting Layer
.
•
Canvas Scaler
(the
Script
component): Defines how the canvas resolution
and positioning units are measured. For more details, see the
Resolution and
scaling
section later in this chapter.
•
Graphics Raycaster
(the
Script
component): This component is part of a
new Raycasting framework delivered with the new
UnityEvent
system.
(See the following
UnityEvent system
section later in this chapter). Events
and human interaction are derived through a new and efficient
Raycasting
system (which the
Graphics Raycaster
is one implementation of). This
provides hit tests from the user's current input position through the Unity UI
layer and feeding back information to the
UnityEvent
system. The settings
here provide configurations to drive how the raycast functions will react;
they are as follows:
°
Ignore Reversed Graphics
: If a
UI
element is reversed (seen from the
back), then this setting will define if a raycast hit will qualify as a hit
or not and generate an event (basically does what it says on the tin).
°
Blocking Objects
: Allows you to block raycast hit tests from 2D, 3D,
Everything
or
None
(allowing hit tests from everything).
Note: By default, raycasts will pass though the UI layer in to your
scene, so this setting can be very useful. But you can also control
this behavior with a Canvas Group (see the
Canvas Group
section
later in this chapter).
°
Blocking Mask
: Allows you to restrict the rendering layers
that raycasts will operate on: you can select multiple layers,
a single layer, or all layers.