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.
Suggested component | Feature |
|---|---|
| Logic component | Attach multiple scripts to handle movement, detect input (arrow keys, mouse clicks), and trigger animations. |
| Collider component | Detect collisions and user interactions (clicks/touches) on the car's surface. |
| Animation component | Play animations on the object (door open, wheel spin). |
| Audio Source component | Play sounds for acceleration, braking, collisions, and in-car audio like the radio. |
| Mesh Renderer component | Render the car's mesh. |