StateTreeAiComponent not executing

I am trying to use the new StateTree AI Component, but cannot get it to run.
I created a Tree and a Pawn with an State Tree AI-Component. But when I Play in Editor, the Tree does not execute. Neither do Task run nor is the OnStateTreeRunStatusChanged-Callback called.
I tried attaching the TreeComponent to a custom AI Controller, but that did not trigger anything either.

Where do I have to attach the StateTree AI Component and what are other requirements to get it to run?

Not sure what your use-case is here, but I’ve had similar problems.

Try adding a StateTree component to your actor / pawn (not StateTreeAI) and then make a StateTree for it by using StateTreeComponentShema (not StateTreeAIComponentShema). Worked for me.

1 Like

Hi @Squamto!

Can you elaborate on what you are doing or provide some screenshots?

The StateTreeAIComponent was designed to be used by AI Controllers and as such, the context requires the component be owned by the AI Controller. The AI Controller would then possess the Pawn to run the StateTree. I have been using this for a StateTree guide in 5.4 and can confirm it is working.

If you do not need the AI controller to always be valid for your use case, you can use the StateTreeComponent. You could also have a Global Task that gathers an AI Controller if one exists during its EnterState event.

-James

FYI, the only way I managed to get the StateTreeAIComponent to run (using 5.4.2) was to manually restart the logic on the controller’s BeginPlay (even though the component is set to start the logic automatically, the state tree debugger will not pick it up unless I do this manual restart)

2 Likes

Thank you so much Mougli!!! Been pulling my hair for the past 3 days trying to figure out why my tree wouldn’t do anything.

1 Like

UE 5.4.3 | Blueprint without C++

There may be some function calls that we don’t understand yet.

I used this tutorial(Your First 60 Minutes with StateTree) to test many times.

BP_ThirdPersonCharacter is of course no problem, but if it is Pawn and Character, there will be two problems:

  1. StateTree is not executed

  2. MoveTo Task execution error?

For the first problem

Take the DetourCrowdController in the tutorial as an example, the Details panel AI->StartAILogicOnPossess of the Controller needs to be checked. (Even if you use the StartLogic node in BeginPlay of DetourCrowdController)

Finally, thank James Keeling for the very detailed and easy-to-understand tutorial.

Thank you for this - I can’t believe you figured this out. I was also stuck on this issue until your solution.

Hope they fix it soon.

I just wanted to also say that if you are on 5.5 and are using StateTrees without a Pawn (just an AiController), then, if you spawn the AiController via code, the StateTree will not run. It really wants a Pawn. It worked fine in 5.4, but seems to have regressed in 5.5.

Or maybe this is WIA…