Trigger

A trigger detects events or player actions within a space instance and writes them to a state.

There are two types of triggers:

  • Item triggers: Set on an item and detect actions or collisions involving the item
    • The component name is XXXXItemTrigger
  • Player triggers: Set on any GameObject to detect changes in the states of all players
    • The component name is XXXXPlayerTrigger

For the list, see Trigger components.

Common trigger settings

Each trigger component provides a field called “Triggers,” where you can configure simultaneous writing to multiple states.

Settings for one state:

  • 1: Specify the state to write to.
  • 2: Set the value to write.

Managing the list of states to write to:

  • 3: Add a new entry.
  • 4: Move this entry up by one.
  • 5: Delete this entry.
  • 6: Move this entry down by one.

Detailed settings

Here’s a detailed explanation of how to specify the state (1) and set the value to write (2).

State specification

In Target, you specify the type and target of the state, and in Key, you set the string key. Below is an explanation of the Target settings:

  • Item states
    • This: The item state of the item on which the component is set (item trigger only)
    • SpecifiedItem: The item state of a specific item
  • Player states
    • Owner: The player state of the Owner of the item on which the component is set (item trigger only)
    • Player: The player state of the player who performed the action (player trigger only)
  • Global state
    • Global: The global state

CollidedItemOrPlayer is a special setting available only in On Collide Item Trigger component. It writes the value to the item state if the collision target is an item, or to the player state if the collision target is a player.

Value specification

In Parameter Type, you specify the state type and set the corresponding value. When the trigger detects an event, the fixed value you set here will be written to the state.

  • Signal: Represents timing only, so no value can be set.
  • Bool: Set true or false using a checkbox.
  • Float, Integer: Specify a numerical value.
  • Vector2, Vector3: Specify numerical values for the x, y, z components of the vector.

In some triggers, such as Steer Item Trigger component, you can specify “Input” as a value. When “Input” is specified, the trigger writes a value reflecting the input state continuously, instead of writing a fixed value.