Time for action – Adding components to Game Objects

  1. In Unity, create an empty Game Object:
    Time for action – Adding components to Game Objects

    Now let's add some components to this Game Object.

  2. In the Component menu you will find all of the components that you can add to this Game Object. In the Rendering Submenu, select the Light option:
    Time for action – Adding components to Game Objects

What just happened?

In Unity you will note that your Game Object now has a light behavior associated with it:

What just happened?

If you were to create a regular Light object from the Hierarchy menu you'd find that both objects are the same. This is because the Light Game Object is simply an empty Game Object with a Light component – simply configured appropriately for the type of light that you wanted to create. If you explore, you'd find that you could configure your light exactly the same as the stock light object.

All of this should show you the possibilities that you have. You are not constrained by an arbitrary construction of objects by the Unity developers. In fact, you can create your own custom components as well and add those components to any Game Object that you desire.

Transform

A transform is the base concept of something in 3-dimensional space. It represents the position, rotation, and scale of an object and can contain links to child objects in a hierarchy. Every object in a scene has one of these, even if nothing is rendered. The Transform Component is the base component that every Game Object has and it is also the one that you cannot remove as it is necessary for your object to exist in 3D space:

Transform
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.31.222