Use this graph when another state machine or script should start a response without the receiving graph polling the sender every update.

In the editor

  1. Add a standalone Idle state named Waiting and an Action State named React. Idle remains Running and is not an entry in an Action State’s Action list.
  2. Connect Waiting to React and replace the default State Finished Condition with Has Received Event.
  3. Enter a nonempty Event Name, such as TargetSpotted, select Receive Mode: Latest, and use Continuous evaluation.
  4. Choose targeted or global delivery. For targeted delivery, assign the receiving state machine’s GameObject.
  5. Optionally assign Stored Value Shared Variables when React needs an event argument such as the detected target.
  6. Put the response Actions in React, then connect React back to Waiting with State Finished.
  7. Add Send Event to the sending graph and configure the same Event Name, delivery choice, target, and argument types.

The Send Event Action targets a named event and can include optional arguments.

The Has Received Event Condition listens for the matching name and stores optional values.

How it runs

Waiting remains active until a matching event arrives. Has Received Event records the optional values, allows the transition once, and clears its received flag. React can then face the supplied target, play an animation, update a variable, or perform another finite sequence before returning to Waiting.

In this Latest-mode setup, returning to Waiting clears any received flag from the earlier activation, so a later reaction requires another event. This makes events suitable for occurrences such as a target being spotted, a door being used, or a dialogue line finishing.

Key choices

  • Use a targeted event when one known GameObject should react. Use a global event only when every matching listener should receive the notification.
  • Match the event name, targeted/global option, target, argument count, and argument types on both sides.
  • Store an event argument in a Shared Variable when several Actions or later states need it.
  • Use a normal Shared Variable Condition instead when the receiver needs persistent state rather than a one-time occurrence.

Verify in Play Mode

Trigger the sender, wait for React to finish and return to Waiting, then trigger it again. Each send while Waiting is listening should move Waiting to React once, and any stored event value should contain the sent argument. A misspelled name or mismatched delivery option should leave Waiting active.