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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.