Unity Lab #3 GameObject Instances
C# is an object-oriented language, and since these Head First C# Unity Labs are all about getting practice writing C# code, it makes sense that these labs will focus on creating objects.
You’ve been creating objects in C# since you learned about the new keyword in Chapter 3. In this Unity Lab, you’ll create instances of a Unity GameObject and use them in a complete, working game. This is a great starting point for writing Unity games in C#.
The goal of the next two Unity Labs is to create a simple game using the familiar billiard ball from the last lab. In this lab, you’ll build on what you learned about C# objects and instances to start building the game. You’ll use a prefab—Unity’s tool for creating instances of GameObjects—to create lots of instances of a GameObject, and you’ll use scripts to make your GameObjects fly around your game’s 3D space.
Let’s build a game in Unity!
Unity is all about building games. So in the next two Unity Labs, you’ll use what you’ve learned about C# to build a simple game. Here’s the game that you’re going to create:
So let’s get started. The first thing you’ll do is get your Unity project set up. This time we’ll keep the files a little more organized, so you’ll create separate folders for your materials and scripts—and one more folder for prefabs (which you’ll learn about later in the lab):
Before you begin, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access