StateTree Overview
- "general-purpose hierarchical state machine that combines the Selectors from behavior trees with States and Transitions from state machines".
- Selection from root evaluating Enter Conditions; advance to children; leaf activated; selecting activates all states root→leaf; tasks of all active states run concurrently; first completing task triggers Transition.
- Elements: Root, Selector State, Enter Condition, Task, Transition (on complete/succeed/fail or monitored condition). Transitions evaluated leaf upward; first success chosen; allows grouping common transitions.
- Behavior trees keep executing selection logic; StateTree runs selection on demand based on Transitions.
- Data: Parameters, Context Data (by Schema; Actor or Smart Object), Evaluators, Global Tasks. Binding rules: Enter Conditions bind to common data and parent-state tasks; Tasks bind to earlier tasks in current and parent states.
- Blueprint: UStateTreeTaskBlueprintBase, UStateTreeEvaluatorBlueprintBase, UStateTreeConditionBlueprintBase.
- Patterns: grouping, Next transition for sequences, hierarchical failure handling, hierarchical data, refining behavior; Mass examples (Mass LookAt).