Triggering Behaviour Tree from Coroutine and Detecting Completion

AntL

Member
Hey there, I'm triggerring a behaviour tree from a coroutine and wondered if there's a clean way to yield, until I can detect when the behaviour tree has executed?

C#:
    IEnumerator StartBehaviourTree()
    {
        behaviorTree.EnableBehavior();
        ???
    }

Thanks!
 
Fantastic - exactly what I needed, but is there a way to check if a particular behaviour tree is running, so after I set it running for one tick I can yield until it detects that it's completed? Thanks for any help!

C#:
    IEnumerator StartBehaviourTree()
    {
        BehaviorManager.instance.Tick(m_behaviorTree);
      
        while ( Behaviour tree is running)
            {
            yield return null;
           }
 
    }
 
You can check the execution status on the behavior tree component: BehaviorTree.ExecutionStatus.
 
Top