When the player presses the fire button, the spaceship should shoot ammo objects in the scene. These objects will be based on an
Ammo prefab. Let's create this prefab now. To start, we'll configure the texture to be used as an ammo graphic. Open the
Textures folder in the Project panel, and select the
Ammo texture. This texture features several different versions of an ammo sprite, aligned in a row side by side. See Figure 4.3. When ammo is fired, we don't want to show the complete texture; instead, we want to show either just one of the images or the images played as an animation sequence, frame by frame.
Presently, Unity recognizes the texture (and each ammo element) as a complete unit. We can use Sprite Editor, however, to separate each part. To do this, select the Texture in the project (if it's not already selected), and then (from the Object Inspector) change the Sprite Mode drop-down from Single to Multiple. This signifies...