Skip to content

Inheritance

State Machines support basic inheritance. Functions can be overridden and variables inherited.

Steps

  1. Open a State Machine blueprint you wish to become a child.
  2. Go to Class Settings and change the parent class to your desired state machine blueprint parent.

Behavior

The child blueprint will behave similar to how normal blueprints work. Functions can be overridden and properties inherited.

State Machine Graphs

State machines will use the most recent valid graph. If no valid State Machine Graph is found on the child the next parent is checked and so on. If you want to easily test switching between a child and parent graph, you can simply disconnect the wire from the Root State Machine to the State Machine Definition (the topmost graph).

The compiler will attempt to notify you of what graph is used.

Call Parent Graph

A parent node can be added to state machine graphs which will run the selected parent state machine. The details panel will allow any parent of the child to be chosen. The state machine is effectively a clone of the parent state machine placed in the same instance as the child.

Warnings When Modifying Parent Dependencies

When using a parent node you may occasionally see this warning when starting an editor play session. the child State Machine: [NAME] may be out of date. You may need to restart the editor play session.

ChildWarning

  • This only effects play in editor sessions. Packaging should always work properly.
  • This can occur when a state machine child calls the parent graph, and the parent graph references any child BP whose parent BP just had a variable modified.
  • To resolve:
    • Either stop the editor play session and restart it...
    • Or press the Compile button of the parent BP you modified to prevent the warning.
  • Why does this occur?
    • In order for inheritance to work properly while also allowing multiple calls to a parent graph, the entire parent graph is cloned into the child during a full compile. When you modify a blueprint, Unreal looks for all dependencies and recompiles, but doesn't always do a full compile.
    • To resolve this, the state machine compiler can detect when this happens, but it can't force a compile at this point. Instead it marks the state machine dirty so when you press play it will receive a full compile. The only time it doesn't work is if you press play without pressing compile first, hence the warning message.