Is this a UE Bug or Am I Using a Weird Method?
I have a Behavior Tree A used for combat logic and Behavior Tree B for idle logic.
My goal is to prevent interrupting an attack montage when a BTTask is aborted. I call FinishAbort in the task only after the attack montage completed.
This approach works correctly when only BT_A is running – the montage plays to the end before the task finishes aborting.
However, when I try to start a different Behavior Tree (BT_B) while BT_A is running, BT_B fails to start.
I found that when run BT_B, UE abort BT_A.But BT_A is wait montage completed, so BT_B is not running immediately.
I dug into the UBehaviorTreeComponent:
The UBehaviorTreeComponent::OnTaskFinished() func is called when a task completes execution, including when it finishes an abort via FinishAbort().
Within the end of OnTaskFinished(), I noticed it calls TrackNewLatentAborts(). This func updates bWaitingForLatentAborts.
After TrackNewLatentAborts(), ProcessPendingInitialize() is called to run new tree.
I observed: Inside TrackNewLatentAborts(), if bWaitingForLatentAborts is true, it immediately returns.And ProcessPendingInitialize() also return;
Is this behavior correct and intended? Or does this indicate that my approach is weird ?