Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Introduction to components

Add various features and behaviors to your GameObjects.
Read time 1 minuteLast updated 2 days ago

Components are features you can add to GameObjects to give them animations, sound, physics, interactivity, functionality or other behaviors. You can add multiple components to a single GameObject. Once you add a component to your GameObject, you can edit its properties in the Inspector window, which gives you more control over the functionality of your objects. There are multiple component types. For a full list of the components you can add, refer to Component types.

Components example - Car

As an example, you have a Car object that's composed of multiple child objects including wheels, doors, seats, and shell. You want the car to have the following features:
  • The car's color changes when the user clicks the shell of the car.
  • When a user clicks on a door, it opens.
  • The user can use the arrow keys to drive the car.
The following table suggests components you can add to the GameObject to give it these features. You might add some components to more specific child objects. For example, add a door opening movement script or animation to the door objects so they move independently from the rest of the car.

Suggested component

Feature

Logic componentAttach multiple scripts to handle movement, detect input (arrow keys, mouse clicks), and trigger animations.
Collider componentDetect collisions and user interactions (clicks/touches) on the car's surface.
Animation componentPlay animations on the object (door open, wheel spin).
Audio Source componentPlay sounds for acceleration, braking, collisions, and in-car audio like the radio.
Mesh Renderer componentRender the car's mesh.

Additional resources