Components

Components come in different forms and they are in charge of adding functionality to GameObjects. They can be used to create behavior (for example, scripts), define the appearance of GameObject (for example, renderers), and influence other aspects of the function of an object in the project. 

All GameObjects contain at least one component. We start with the Transform component. This component is in charge of telling the Unity engine the position, rotation, and scale of an object. Other common component elements include Renderer and Collider. We will be looking at their uses in the upcoming chapters in this book.

Components are added to a GameObject by selecting the object and then clicking on the Component menu of the menu bar or by hitting the Add Component button on the Inspector window.

Components can also be dragged from the Project window into the GameObject (for example, you can drag a script from the Project window onto a cube on the Scene view and the script will automatically appear in the Inspector window).

Drag one of the images you added to the Project window previously into the cube of the Scene view to convert it into a texture:

The cube in the scene with the image as a texture

Now that we know about the visible elements of a project, let's talk about the invisible ones: the scripts.

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

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