Game Development Reference
In-Depth Information
Figure 4-9.
Enabling BoxCollider visibility in the Scene viewport. If disabled, no colliders will be visible
After Collider visibility is enabled, add a new BoxCollider component to the power-up object in the
scene. To do that, select the power-up object, and choose
Component
➤
Physics
➤
Box Collider
from the main application menu. Once added, use the collider
Size
property, in the Object Inspector,
to size the collider, surrounding the power-up and leaving some margin of space around the fringes.
Be careful to give the collider some depth, too, even though the power-up object is really a flat
sprite. It'll need depth for collisions to work properly (see Figure
4-10
).