Components

Components add additional functionality to a GameObject. These components come in many forms. Here are some of the components we already have or will see in this chapter:

  • Transform: The job of this component is to define the position, rotation, and scale of each GameObject in a scene. This is the minimum defining element of a GameObject, so all GameObjects have one.
  • Camera component: We have seen this component when we set up the camera earlier in this chapter.
  • Mesh renderer: This handles details of lighting and materials.
  • Rigidbody: This component allows you to control how the GameObject reacts to physics.
  • Box collider: This component adds a way to detect and react to collisions in the program.

As a point of reference, a simple cube is made up of five components. First we have the Transform component, whose job it is to set the Position, Rotation, and Scale of the object it is attached to. Another component is Box Collider, which provides the unity system with the ability to know when the object hits another object.

We also have the Mesh Renderer, here we can set certain properties involving materials and lighting. We can tell the object whether we want it to cast or receive shadows, we can change the materials applied to the 3D object as well.

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

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