Time for action – creating a target for the cannon
To complete our prototype, we'll add a target for the player to attempt to hit with a cannonball and make it change color when they've successfully hit it. Perform the following steps to do so:
Create a new Cube from the Hierarchy window's Create menu.
Position the cube at 20, 5, 0 so that it's on the opposite end of the plane from the cannon and slightly higher than it.
Your cube should look as shown in the following screenshot:
We want our target cube to be a bit larger and easier to see, so we'll make a few more changes to it.
Increase the scale of the cube to 3, 3, 3.
Create a new Material, assign it a unique color, and apply it to your target by clicking-and-dragging it from the Project window to the cube in the Hierarchy window.
After making the previous changes, your target cube should look as shown in the following screenshot:
Now that our cube is a clear target, we can script it to react when a cannonball hits it. In full games, hitting...