Home ยป Core Concepts»Actions
Index
Navigation
Community Wiki

Actions

Overview

Each state has a list of Actions to execute when active. 

Each Action has a specific purpose: To play an animation, to move a game object towards a target, to test for a collision etc.

Simple Actions can be combined to create complex behaviors.

Execution Order

Actions are activated in the order they are listed, from top to bottom. You can drag and drop actions to re-order them.

IMPORTANT: The entire "Action Stack" is executed every frame, so multiple Actions can be active at the same time (E.g., Move Towards and Look At can run at the same time)

IMPORTANT: If an Action triggers a transition, the transition happens immediately and the Actions below it are not executed.

Action Life Cycle

Actions are activated when the State they belong to becomes active.

When activated, actions Start, and every frame they Update until they Finish or the state is Exited.

Each frame every Action in the list that has not finished is updated in turn from top to bottom.

Actions are color coded in the State Inspector to indicate when they are active. For example:

After pressing Play the Intro state becomes active and all of its Actions are activated.

After 1 second, the Camera Fade In Action is complete. The action fades to show that it is finished.

10 seconds after the state was activated, the Wait Action is complete and fades out.

IMPORTANT: Remember Actions run concurrently, the Wait action is running the whole time!

Actions that need to run in sequence should be in separate states linked by transitions.

What does "finish" mean?

Each Action has its own criteria for finishing. The criteria is generally obvious from the Action:

Some Actions finish instantly: Set MaterialStop AnimationEnable Behaviour ...

Some Actions take time to finish: Move TowardsCamera Fade InFloat Interpolate ...

Some Actions implicitly never finish and are designed to be active as long as the state is active: BlinkFlickerMouse Pick Event ...

Many Actions have an "Every Frame" option that tells them to repeat every frame:

  • Every Frame set to True: The Action repeats every frame and doesn't finish until the state is exited.
  • Every Frame set to False: The Action executes once and is finished.

FINISHED Event

When all Actions on a state have finished, a FINISHED event is sent to the state machine.

You can use this event to transition to a new state.

See Events.

 

See Also:

 


Last modified on 1/4/2016 7:02 PM by User.

  • RSS Feed