-
Notifications
You must be signed in to change notification settings - Fork 8
States
States have three main types: States, State Machines, and Conduits.
Contains Begin, Update, and End entry points.
Once a state is entered the Begin logic will execute and will not execute again unless the state is re-entered.
This occurs every tick the state is active and the Delta Seconds from the last tick is passed in. If you disable tick and manage state updates on your own it is your responsibility for passing in the Delta Seconds.
Always occurs when a state ends. This will trigger before any Transition Entered logic plays or the next state starts.
It is possible to nest State Machines as many times as you want. Priority is given to the super state so you may want to have transitions leading out of the nested State Machine wait for its completion. There is a helper blueprint node: Has State Machine Reached End State which is perfect for this, but requires the nested State Machine have an end state.
Super State Machine A changes states to sub State Machine B. Once sub B becomes active it will start the first state of sub B. On the next tick super A transitions are evaluated first. If a transition out is active it will then call On End on sub B triggering On End of the nested state.
You can reference other State Machine blueprints to allow for re-usability. They function the same as nested state machines.
- The context of the super State Machine will be passed into the reference automatically.
- The reference will inherit the super State Machine's replication settings.
- The system attempts to catch circular referencing, but ultimately it is up to you to make sure you don't run into an infinite loop.
State machine references can optionally have an intermediate graph. This allows you to hook into entry points for when the reference starts, updates, or ends.
- The context of the reference can be changed.
- An optional node
Get State Machine Reference
is available in this graph.- Reference variables can be read or set from here.
- An optional entry point
On State Machine Start
is available for initializing properties.- This fires when the root state machine of the blueprint owning the reference starts.
Conduits only consist of a boolean operation which must be true before any outgoing transitions are evaluated.
Clicking on a state will let you configure any properties of that state.
- Ensures that the On Update method is always called at least once before exiting a state. Without this it is possible the update method may not be called in the scenario where a state starts and then on the next tick it completes.
- When true the current state is reused when the state machine exits and restarts.
- When false the current state is cleared on end and the initial state used on start.
- References will inherit this behavior.
- Do not reuse if in an end state.
- References will inherit this behavior.
- Allows the state machine reference to tick on its own.
- The Update method will call Tick only if Update was not called by native Tick.