Book Image

Learning Unity iOS Game Development

Book Image

Learning Unity iOS Game Development

Overview of this book

Table of Contents (14 chapters)
Learning Unity iOS Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Main Menu, iAds, Leaderboards, Store Purchases, and Achievements
Index

The prefab creation


In order to create a prefab, you must first have a collection of GameObjects that you want to keep together as one prefab.

Perform the following steps:

  1. Navigate to the Assets folder. Right-click on it and select Create and then Folder. Name this Prefabs.

  2. Select the Axe GameObject in Hierarchy. This is the one we created in the last chapter. Click on it and drag it onto the Prefabs folder.

This will create an Axe prefab that we can use in the future that holds everything the current Axe GameObject does.

Anytime in the future, when we want to create an axe, we will have a complete file that holds everything we know as axe.

This is essentially all it takes to create prefabs. These are an incredibly simple and useful aspect of creating games with Unity.

Coin prefabs

Let's create a couple of different varieties of coins, so when we use them in our level, we will have a more efficient system. Perform the following steps:

  1. Start by creating a new empty GameObject in the Hierarchy tab...