General

Visual Logger can be used to see what states/tasks the tree is selecting. A state tree debugger can also be opened from the state tree editor’s menus, which can display what state you are currently in, and some other details.

You can use both of these debugging methods to see whether your state tree’s tasks are being ran, and what the results from them were.

Common problems

Incorrect use of BeginPlay / On Possess

If you use state trees in AI Controllers, make sure to only call Start Logic after both Begin Play and On Possess have ran. The State Tree can refuse to start or freeze otherwise. Also note that Begin Play and On Possess can run in different order depending on whether your actor is placed in the level or spawned at runtime.

Typically this problem shows as the state tree “starting” and then not doing anything at all. In Visual Logger, this is visible as the state tree output showing “State Tree Started” and then no other output from it.

Using StateTreeAIComponent in a non-AIController

The StateTreeAIComponent only works in AIControllers. If you want to use a state tree in some other actor type, use the “regular” StateTreeComponent instead.

Other common issues

  • Check any of your global tasks don’t return success immediately, which stops the tree (This should show up in visual logger)
  • Check that tasks/evaluators don’t use external data which is unavailable
    • This will not say anything useful in logs at least in Unreal Engine 5.4.2. The log will simply say the tree is being started, and then no other state tree output.
    • This is the same issue as above Incorrect use of BeginPlay / On Possess with the same fix.
  • Crashing when using GetExternalData may be caused by attempting to access external data that doesn’t exist. For example, if you try to access an AI Controller, and your state tree is in the pawn.
  • Crashing when using GetInstanceData may be caused from a missing GetInstanceDataType.
  • Check that your Schema is configured correctly in the State Tree Editor. If Context Actor Class (or any others in the schema) is set to a class which doesn’t match the actual classes used, this can cause the tree to freeze