Disabling A Behavior Tree

SolarFalcon

New member
BehaviorTree.enabled = false doesn't work at all. I'm using Pursue in the Movement pack, and I set this to false and it keeps ticking away.
BehaviorTree.DisableBehavior() isn't working either. I have a dead enemy chasing the player due to this.
 
Last edited:
Disabling a BehaviorTree won't stop movement, as movement Tasks usually just check the current state of movement. You'll need to explicitly tell the enemy to stop either in a branch of the tree (e.g. IsDead?) or in the same place you are disabling the BehaviorTree.
 
Thanks for the response. Yeah I came to that conclusion about an hour ago, so I added a bool test to make the action enter the fail state.
 
Which movement task are you using? When OnEnd is called it actually should stop the agent from moving.
 
Are you using the NavMeshAgent? As a test I disabled the behavior tree when the agent was in the middle of pursing the target and the task stopped.
 
Yeah, the enemy is using a NavMeshAgent. Like I said, I've been getting some strange activity over here. I have screwed around a little with the code so it can work with my Animation Controller, but I don't think anything I've done is causing this. I found a method to get around this for now though till I figure out what is the problem.
 
Top