The reticle cursor
A variant of the visor HUD that is essential in first-person shooter games is a reticle or crosshair cursor. The analogy here is that you're looking through a gun-sight or an eyepiece (rather than a visor), and your head movement is moving in unison with the gun or turret itself. You can do this with a regular game object (for example, Quad + texture image), but this chapter is about UI. So, let's use our canvas, as follows:
Find your Main Camera object in the Hierarchy panel.
From the Project panel, drag the
DefaultCanvas
prefab onto the camera object so that it becomes a child of the camera. Name itReticleCursor
.Set the Rect Transform component's Pos X, Pos Y, Pos Z to (
0
,0
,1
).Delete its child objects—Image and Text.
Add a raw image child by selecting from the main menu bar navigating through GameObject | UI | Raw Image and making sure that it's a child of
ReticleCursor
.In the Raw Image panel's Rect Transform, set Pos X, Pos Y, Pos Z to (
0
,0
,0
) and Width, Height to...