GameObjects and components
We talked about our project being composed of assets
(the project's files) and that a scene (which is a specific type of asset) is composed of GameObjects; so, how can we create an object? Through a composition of components.In this section, we will cover the following concepts related to components:
- Understanding components
- Manipulating components
Let's start by discussing what a component is.
Understanding components
A component is one of several pieces that make up a GameObject; each one is in charge of different features of the object. There are several components that Unity already includes that solve different tasks, such as playing a sound, rendering a mesh, applying physics, and so on; however, even though Unity has a large number of components, we will eventually need to create custom components sooner or later.In the next image, you can see what Unity shows us when we select a GameObject:
If we needed...