Behavior Tree not stopping after object is destroyed

phuture2k

New member
Hi, I'm trying to stop my behavior tree after the owner object is destroyed and it is not working. I'm using an external behavior tree.

Here's what happens with Log Task Changes (seems like behavior designer itself is trying to stop it, but it keeps running):
1670640061947.png

I also tried to pause it myself, but also doesn't work:
C#:
behaviorTree.DisableBehavior();
Debug.Log($"Behavior disabled {this.gameObject}");

1670640113857.png
 
How do you know the tree isn't stopping? What is causing the exception at the end of the screenshots?

Do you have two BehaviorManagers within the scene? The behavior tree should stop automatically when it is destroyed. Can you list the steps to reproduce from a fresh project?
 
The exception happens because the behavior tree is trying to reference it's own GameObject and fails because the object was destroyed (that's how I know it's still running).
There is only one BehaviorManager in the scene.
I'm using an external behavior tree and tasks run mostly on fixed update.
I wasn't able to reproduce this from an empty project.
 
If you can send the project to support@opsive.com I can take a look, but I haven't seen this behavior before so maybe a different script is throwing an exception and that's causing the rest to fail?
 
Top