Ammo prefabs

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:

Ammo prefabs

Figure 4.3: Preparing to create ...

Get Unity 2018 By Example - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.