In this very first post of Add Component I will talk about the Unity 3d Fundamental Concepts. For all of you just starting this may be quite helpful in getting your head around the Unity World. However, If you are an experienced developer please feel free to stop now before you end up bored to death with this article.
I tend to see Unity as a very specific world, and the best way to understand how a world functions is to learn about its elements and how they interact.
A Unity Project has four main elements: Assets, Scenes, GameObjects and Components. Each one has a special role in the Unity World and are all essential to a complete Unity Project.
Assets are the actual contents we use to shape our own Unity world. Usually, most of the Assets are created using external software and then imported into the project.
On their own they are no more than media content files: 3d models, textures, audio files, scripts and so on.
In order to exist in our product the Assets need to be included inside a Unity Scene.
A Scene is a self-contained 3d space where all the action happens. Every Unity Project needs to have at least one Scene. Without it, the project will be just a pile of stored Assets because they have no place to actually exist.
Most project will have multiple Scenes. The most common use of Scenes in game development is to create different levels inside a game, however this will largely depend on the project specifications and design. Although it may have as many as necessary, it is important to state that only one Scene is active and running at a given time.
So, Scenes are the 3d space where Assets can exist. But, to include the Assets on a Scene we need GameObjects.
A GameObject is the base entity of our Scene. If we want anything to exist on our Scene it needs has to be a GameObject. But by itself is no more than that. It just represents something that exists inside our 3d world and that’s it.
If a GameObject wants to be something more it needs to have Components.
A Component is responsible for assigning roles, properties and/or behaviours to GameObjects. It is the smallest building block on our world and by far the most important one.
For example, If we want a GameObject to represent a Light in our Scene we just attach it a Light Component. If it is a static rock in our environment we attach the necessary Components for it to be a rock (we need to display the rock shape and texture and maybe a collision box). If we need a more complex GameObject such as our Player Avatar, we would need to attach a component for its’ shape, textures and all his behaviours.
So as you can see, according to the Component type (and believe me they are many) we can attach assets to our GameObjects, define properties, assign behaviours scripts and so on.
Unity 3d Fundamental Concepts
- A Unity Project has one or more Scenes;
- Each Scene will have one or more GameObjects;
- Each GameObject will have one or more Components;
- Components may have (or not) one or more attached Assets.
Check the following scheme to understand the relationship among this Unity 3d Fundamental Concepts.