Making games
Components
A component is one piece of what an object is or does: a mesh to draw, a body for physics, a light, a sound, a script. An object can carry any mix of them, at most one of each kind (scripts are the exception: an object can have several).
Adding and removing
Select an object and click Add Component at the bottom of the Inspector. The list is grouped by category and has a search field; your own script components are in it too, under the category the script names. New Component at the end of the list writes a new script and adds it in one step.
Each component is a card in the Inspector. The … at the right of its header has Reset (every property back to its default), Copy Component and Paste Component Values (onto another object’s component of the same kind), and Remove Component. Every add, edit and removal can be undone.
Editing properties
A component’s properties are rows on its card: numbers, checkboxes, colors,
choices from a list, and pickers for assets (a mesh, a material, a sound) or
other objects (the other end of a joint). Drag a number field sideways to
scrub it, or click to type. Every property can also be read and set from a
script with set_property or get_component; see
Working with objects.
What’s built in
| Category | Components |
|---|---|
| Core | Transform |
| Rendering | Mesh Renderer, Text, World Environment, Reflection Probe |
| Lighting | Directional Light, Point Light, Spot Light |
| Camera | Camera |
| Physics | Rigid Body, Collider, Character Controller, Fixed Joint, Hinge Joint, Spring Joint |
| Effects | Particle Emitter |
| Audio | Audio Source, Audio Listener |
| Animation | Animator |
| UI | Canvas |
| Scripting | Script, and every script you write |
The component reference lists every property of each, with its default.