Mass StateTree
You can create custom StateTrees and StateTree Tasks for use with Mass Entities.
- The StateTree must use the Mass Behavior schema (
UMassStateTreeSchema)- This allows us to link Mass Fragments as External Data
- StateTree Tasks must derive from
FMassStateTreeTaskBase
UE 5.5 StateTree Task Examples
- Look At
- Smart Object: Find, Claim, Use
- Zone Graph:
Path Follow,
Claim Wait Slot,
Stand
- Find Zone Graph Target: Escape, Smart Object, Wander
Mass Entity Configuration
To configure an entity to use a StateTree:
- Create a new
State Treedata asset (aUStateTree)- Choose schema:
MassStateTreeSchema(aka “Mass Behavior”) - Example name:
ST_MassEntity
- Choose schema:
- Add a
UMassStateTreeTraitto the entity config data asset- Select asset:
ST_MassEntity(the one you created for this entity)
- Select asset:
StateTree Ticking
In general, the Mass StateTree is limited to the Game thread, however it does NOT necessarily tick on every frame.
The Mass StateTree ticks for a given Entity only when it is
explicitly signaled by UMassStateTreeProcessor, which itself listens for and reacts to
specific UMassSignalSubsystem signals.
Thus, in your C++ code you must explicitly manage the ticking of the StateTree and ensure to signal Mass every time you want a given StateTree to tick.
Due to this CPU-efficient ticking policy, in your StateTree Task Tick methods, you will see VERY HIGH
values for DeltaTime. The DeltaTime in this case is not the game thread DeltaTime,
it is instead the full length of time that has elapsed since the last
explicit StateTree tick, which could be many seconds ago (or longer).