public void SetBehaviour(GameObject gameObject) { if (gameObject != null) { manager = gameObject.GetComponentInChildren <BehaviourManager>(); if (manager != null && !string.IsNullOrEmpty(_behaviourName)) { manager.ActivateBehavior(_behaviourName); } } }
private void OnEnable() { behaviourManager = target as BehaviourManager; var behaviorsList = behaviourManager.GetType().GetField("_behaviours", BindingFlags.NonPublic | BindingFlags.Instance); defaultBehavior = behaviourManager.GetType().GetField("_defaultBehavior", BindingFlags.NonPublic | BindingFlags.Instance); _behaviours = (List <BehaviourDefinition>)behaviorsList.GetValue(behaviourManager); GetBehaviorNames(); }