Component reference
Physics components
Trigger component
5min
The Trigger component allows you to detect when entities enter or exit a collider's area and perform actions in response.
A Trigger component requires a Collider component (which in turn requires a Rigidbody component) to function.
Property | Description |
---|---|
Target object | The entity that will be affected or receive the action when the trigger is activated. |
On Enter | The action or event to execute when an entity enters the trigger's collider. |
On Exit | The action or event to execute when an entity exits the trigger's collider. |
- To set up a trigger, add the Trigger component to an entity with a valid Collider.
- Assign a Target object by dragging the desired entity from the hierarchy into the Target object field.
- Select actions for On Enter and On Exit from the available options, which depend on the target object's components.
- Actions include setVisible and setInvisible.
- Ensure that the collider is properly set up and that the trigger's area covers the space where you want the interaction to occur.
Updated 05 Dec 2024
Did this page help you?