GameObject Vs. Components in Unity
Notes:
Game Object:
Any object which is part of a game scene is a game object.
Game object is a container object for components with some common properties & functionalities.
Common properties: Game object header
Active checkbox: allows us to set the active state of the game object
Name textbox: allows us to set name of the game object
Static checkbox: allows us to set this game object is dynamic or static
Tag dropdown: allows us to set the tag of the game object
Layer dropdown: allows us to set the layer in which the game object is placed
Common functionalities:
All game objects have some common functionality like adding and removing components
Note:
Game objects are building blocks of a game scene.
Game object is defined by its components
Components:
Components define the game object & its functionality (behavior)
Ex:
Transform:
defines the position, rotation & scale of a game object
Every game object contains one irremovable component i.e. Transform
Mesh Filter:
Mesh Filter defines the geometry (Mesh) of the 3D Object
Mesh Renderer:
Mesh Renderer renders the geometry (Mesh) based on the Mesh Filter
Collider:
Collider defines the geometry for physics collision
Light:
Light component defines how the light is emitted through a game object
Note:
Components are the building blocks of a game object.
To build any game object the base game object is the empty game object.
Empty Game Object:
Empty game object is a game object with only Transform component
Note:
Empty game object is a base game object for all other game objects.
We can build any specific game object by adding necessary components to an empty game object.
Cube Game Object:
A game object with Mesh Filter, Mesh Renderer, Box Collider
Directional Light Game Object:
A game object with Light
Summary:
1 project = 1 Game
Game is a collection of game scenes
Game scene is a collection of game objects
Game object is a collection of components
Component is a collection of properties
Game object is a container object for components
Game Objects are building blocks of a game scene
Components define the game object & its behavior
Components are the building blocks of a game object
Empty game object is a base game object for all other game objects
We can build any specific game object by adding necessary components to an empty game object