BehaviourManager instance is null

AntL

Member
Hi, I'm trying to control a behaviour tree (as directed in other question) so I can update manually within a coroutine (within Team Member). I have a behaviour tree on my gameobject which references an external beahviour. I have start when enabled set to false, and I'm trying to trigger it with this code:

Code:
    IEnumerator StartBehaviourTree()
    {
        if (BehaviorManager.instance == null) Debug.LogError("Behaviour tree instance is null");
              
        BehaviorManager.instance.Tick(m_behaviourTree);
      
        while (m_behaviourTree.ExecutionStatus == BehaviorDesigner.Runtime.Tasks.TaskStatus.Running)
        {
            yield return null;
        }

    }
Capture.PNG
The issue I'm having is that BehaviorManager.instance is Null. Is there additional code I need to add to initialise BehaviourManager?



Thanks!
Ant
 
Ok it seems if I don't click start with enabled, I have to manually add a behaviourmanager to the scene.
 
Glad you got it figured out - yes, adding the manager manually is the correct approach.
 
Top