GameObjects are core aspect of Unity development. GameObjects compose every aspect of your game. There are GameObjects for your player, the aliens, bullets on the screen, the actual level geometry — basically, everything in the game itself.
Just as the Project Browser contains all assets, the Hierarchy contains a list of GameObjects in your scene.
To see this, you’ll need to have your project open so, if it isn’t open already, do so now. Feel free to down load the project in progress for this lesson:
https://drive.google.com/file/d/1JkwomUuaGZ75qDjfMW0cxHmTmhFDCJFt/view?usp=drive_link
Note: This tutorial is part of a collection that teaches Unity development from the ground up. You can read the entire series over here. This series is free and does not require any account creation. All assets are provided. If you find it useful, feel free to buy me a coffee.
Identifying GameObjects
GameObjects provide the structure to your game. They provide appearance and behavior. Everything on the screen is a GameObject and there are systems in the background composed of GameObjects.
Once your project is open, take a look at your Hierarchy and count all the GameObjects.

Your first thought may be three because you added three GameObjects in Chapter 1. You added the Bobble Arena, the space marine body and the space marine head. However, there are three other GameObjects: Main Camera, Directional Light and the Global Volume. Unity created these by default, but these are also GameObjects.
You’ll notice that there are disclosure triangles to the left of the GameObjects that you imported.
Holding down the Alt button on PC, or Option on Mac, click the disclosure triangle next to the BobbleArena.

As you can see, you have so many GameObjects:

Three important aspects of GameObjects:
- GameObjects can contain other GameObjects. On a base level, this useful behavior allows organizing and parenting of GameObjects that are related to each other. More importantly, changes to parent GameObjects may affect their children — more on this in just a moment.
- Models are converted into GameObjects. Unity creates GameObjects for the various pieces of your model that you can alter like any other GameObject.
- Everything contained in the Hierarchy is a GameObject. Even things such as cameras and lights are GameObjects. If it’s in the Hierarchy, it’s a GameObject that’s subject to your command.
- Every GameObject has a location in 3D space. This is even true for GameObjects that aren’t visible. For instance, you may have a GameManager that spawns monsters and keeps track of the score. While this Manager doesn’t exist onscreen, it still exists at 3D coordinate even though it doesn’t interact with the 3D world.
Your hero is so bored that they are picking their nose with their gun. You need to get them moving but, first, you need to reposition your GameObjects.
Understanding coordinate systems
If you do not understand coordinate systems, stop reading this series. Head over to Kahn Academy for a quick refresher. It’s not difficult and shouldn’t take you long to complete. You can find a link on the subject here:
https://www.khanacademy.org/math/geometry-home/geometry-coordinate-plane
When placing your GameObjects, you place them on a 3 axis coordinate system. Most of the time, people learn about a two axis coordinate system. The x axis represents the horizontal numbers and the y axis represents the vertical axis
With Unity, you are using a 3 axis system. Whereas the x-axis goes horizontal and y-axis goes vertical, the z-axis back and forth. Here is a visualization:

There are different types of coordinate systems out there. Unity is known as a “left handed” coordinate system in that that y-axis points up.
When you place objects in Unity, you are often placing them in the global space, but often times, you work with objects in their own local space. Take this simple 2D graph:

Here there is an GameObject at point (3,3). Now imagine this GameObject has a child at (4,4).

A child GameObject’s coordinates are expressed relative to the parent. From this perspective, the child is located at (1,1). Yet, in the global space, it’s still remains at (4,4). Finally, from the child’s position, it is located at (0,0) and its parent is located at (-1,-1). Everything is relative.
Transforming coordinate systems
You can really see these concepts in action when you transform a coordinate system. To try this out, you’ll create a 3D cube. Unity allows you to create basic shapes. In the Hierarchy, click the plus sign.

Once the flyout menu opens, you’ll see a lot of options. Select 3D Object / Cube.

You’ll now see a 3D cube in your scene. Now press the e key to activate the Rotate Tool. Rotate the cube at least forty five degrees on the z-axis (blue).

With the cube selected, press the w key to activate the Move Tool. Notice the gizmos in the middle of the cube are rotated as well.

These tools are now aligned to the local coordinates of the cube. The y-axis no longer points up. Now imagine you want to raise the cube on the y axis in your scene. In the scene view, you’ll notice a Local dropdown. Click it and select global.

Switching to global changes the gizmo.

Now the transform arrows align to the global coordinates.
Don’t worry if this is confusing. It takes time to fully understand it. That said, you don’t need the cube. Click on it to select it and press delete on Windows or Command-Backspace on macOS.
Where to go from here
That was a lot of theory. You learned about GameObjects and coordinate systems. This is fundamental to creating 3D games in Unity. The same is true for 2D games as well. They key thing: GameObjects compose game elements and each GameObject has a location. These locations are expressed either in global or local coordinates
You’ll put this all to use in the next tutorial when you meet the Transform component.
Discover more from Jezner Blog
Subscribe to get the latest posts sent to your email.