From the course: Unity 2023 Essential Training

GameObjects and asset creation - Unity Tutorial

From the course: Unity 2023 Essential Training

GameObjects and asset creation

- [Instructor] Game objects are the basis of everything you see in a scene. Every item in your scene, whether it's a light, a prop, or a character, is a game object. If we look at our scene here, everything is a game object. So the sky and fog volume, the sun, the main camera, everything is a game object. So if you look at it on the right side this is a game object with specific things added to it, which makes it a sky and fog volume. So if we right click inside of our hierarchy, we have create empty. So let's go ahead and do that. Let's create an empty game object. And as you can see, we have created a game object. So if we take a look at the right here it's called a game object. We have a position in the space of our scene, but it's not really anything yet. So the way it works inside of Unity and basically what you see in the inspector when you click on any other game objects here is all the elements that have been added to this game object to make it a light, to make it a mesh, and so on so forth. And the way you transform a base game object into something else, it's by adding a component. So if you click add component you have all these elements that you can add to the game object to make it something else. So let's say for example, we wanted to make it a light we could search for light and then add a light component and now it's becoming a light. So now it has all the properties of a light that we can actually specify now for that specific game object. And you can continue down this path by adding anything here. So if you don't want this game object to be a light, you can actually remove that component. And then let's say for example we want it to be a 3D object, so therefore we can have a mesh renderer to it. Then we added the mesh render and now it can become a 3D object. So if you take a look at all the other objects that we have on our scene it has specific components to make it a main camera in this case, and it has all the elements of a camera. We have an audio listener, which is another component for this camera. So the next time you look at a very complicated scene like the one that we have in our test, you can see that we have multiple game objects which has multiple components to make it that specific item. But at the end of the day, all of it is a game object.

Contents