State Tree events persisting across linked assets

If you have a state tree that has a linked state tree in it. When the linked state tree gets a state tree event, even without consuming it, if that tree falls back to the main tree, that event is no longer relevant.

For example, (in uploaded file). Starter top-down content. Level blueprint has a keypress of G to send an event to the state tree of the test pawn. (Cube) The example below is just to ping-pong back and forth between the start state on the root and the waiting state on the linked asset.

Main State Tree is

Root - Goes to linked on event (just to start the process)

  • Start - Requires event to enter, consumes event on enter, goes to linked tree on next button press event.
  • Linked - When state ends, go to start.

Linked has

Linked Root - Falls to child state

  • Wait for keypress - Waits for the keypress event and finishes the tree. Does not consume the event.

When you press the button while in “Wait for Keypress”, the linked state finishes and tries to go to the Start State, but the start state fails the enter requirements because the event is not there. Even though nothing in the linked tree consumed the event.

Is this intentional or a bug?

Steps to Reproduce

Hi John,

I believe that this is intended behavior and I don’t think this is an issue of the event being consumed when it shouldn’t be. In your scenario the “Linked - Wait for keypress” state would be a leaf node of the “Mater Root” state. When the linked state is the active state, the master state will also be active as it’s parent, also listening for the ButtonPressed event. When the event is triggered both state’s transitions will be evaluated. However, since transitions are checked from leaf to root the Linked state’s transition is evaluated first, Is a valid transition and is executed without checking any further transitions.

Using your repro project, I changed the linked state’s event transition to be low priority. Now in the debugger it shows that the state tree will also evaluate “Master Root”'s transition and will execute it instead as the higher priority:

Normal Priority:

[Image Removed]Low Priority: [Image Removed]

I see. Thanks!

I wasn’t quite sure how those priorities are handled. This is much clearer.