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.
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.
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)
BP_ThirdPersonCharacter is of course no problem, but if it is Pawn and Character, there will be two problems:
StateTree is not executed
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.
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.