Trigger¶
After gameplay components have been added to an object, they still need good timing to work. The Trigger component lets you attach a trigger for gameplay components and specify the conditions.
Note: You can add Trigger to any gameplay component. The following instructions take Rotate as an example.
Setting rotation triggered by the current object¶
-
Select an object in your scene and add the Rotate component to it.
-
By default, a trigger is attached to the component. If you want to add more triggers, choose + Add trigger on the component panel.
-
Choose a trigger object. By default, the trigger object is Self. Now the gameplay component is triggered by the current object itself.
-
Choose the condition for the trigger.
- On start, triggered when you switch to Play mode.
- Touched by player, triggered when the object is touched by the player.
- On enter, triggered when the player enters the area in which the object is located.
- On exit, triggered when the player exits the area in which the object is located.
Setting rotation triggered by another object¶
-
Select an object in your scene and add the Rotate component to it.
-
By default, a trigger is attached to the component. If you want to add more triggers, choose + Add trigger on the component panel.
-
Choose Others as the trigger object. When Others is selected, the gameplay component is triggered by another object.
-
Select the object.
-
Choose the condition for the trigger.
- On start, triggered when you switch to Play mode.
- Touched by player, triggered when the object is touched by the player.
- On enter, triggered when the player enters the area in which the object is located.
- On exit, triggered when the player exits the area in which the object is located.
-
View the trigger object.