Intermediate Unity 3D for iOS: Part 1/3

This is a tutorial by Joshua Newnham, the founder of We Make Play, an independent studio crafting creative digital play for emerging platforms. Unity is arguably the most popular 3D game engine for iOS – and for many good reasons! Rapid development. Writing your game with Unity is far quicker than trying to write your […] By .

Leave a rating/review
Save for later
Share
You are currently viewing page 5 of 5 of this article. Click here to view the first page.

Prefabs — and how to Take Advantage of Them

This section is just an optional note that may be useful for you later – feel free to skip if you need a break! :]

A game app normally consists of a lot of objects that are identical but are used multiple times. For instance, you may have created a city using the same building over and over again. An efficient way to do this is to create a master template which you can reuse over and over again. As well, it gives you the advantage of being able to update all of the objects by simply updating the template.

Unity provides the ability to do this through the use of Prefabs. Prefabs allow you to create one master copy of an object and create multiple identical copies of it. However, even if you don’t want to create multiple copies of your object, it still provides an efficient way of creating and managing a setup for each of your game objects.

To create a Prefab, you can either just drag over an object from your Hierarchy panel to your Project panel, or you can explicitly create a Prefab via the Project dropdown and then drag the object(s) from your Hierarchy panel into this object.

Now each time you want to create another object from this template, you just need to drag the Prefab over to the scene. Very easy — and very useful! :]

Note: to make an update to your Prefab, just grab any Prefab of the type you’re interested in, make your updates, and then select the Game Object -> Apply Changes To Prefab option from the toolbar menu. The changes will automagicall propagate to all associated objects!

Note: to make an update to your Prefab, just grab any Prefab of the type you’re interested in, make your updates, and then select the Game Object -> Apply Changes To Prefab option from the toolbar menu. The changes will automagicall propagate to all associated objects!

Where To Go From Here?

Congratulations, you made it! You’ve gotten through the hardest part – getting used to the Unity GUI as a complete beginner – from here on out it will be smooth sailing :]

Here is a sample project where we have left it off in the tutorial so far. To open it in Unity, go to File\Open Project, click Open Other, and browse to the folder. Note that the scene won’t load by default – to open it, select Scenes\GameScene.

So far, you have explored how GameObjects can contain children and their children live in their space (in terms of pose). You looked at Lighting concepts and Colliders , and associated Physics concepts with your objects. You also added a Physic Material to the ball to influence how it reacts when a collision occurs, as well as seeing how Colliders can be used as triggers or by the physics engine.

And that’s it for the first part! :] In the next section of this tutorial, you’ll bring your scene to life with interactivity and animation. That will happen when you’re introduced to Scripting. Until next time!


This is a tutorial by Joshua Newnham, the founder of We Make Play, an independent studio crafting creative digital play for emerging platforms.