using UnityEngine; namespace AI.BehaviourTree { public class BehaviourTree : MonoBehaviour { private Node rootNode; private void OnEnable() { NodeStatus status = rootNode.Start(); Debug.Log("Behaviour tree started"); Debug.Log($"Behaviour tree start root node status: {status}"); if (status != NodeStatus.Running) enabled = false; } private void OnDisable() { Debug.Log("Behaviour tree stopped"); rootNode.Stop(); } private void Update() { NodeStatus status = rootNode.Execute(); Debug.Log($"Behaviour tree execute root node status: {status}"); if (status != NodeStatus.Running) enabled = false; } } }