BehaviourRunner

class in RenownedGames.AITree / Inherits from MonoBehaviour

The main component to run created behaviour tree assets. Use Behaviour Runner component to access associated behaviour tree and blackboard of related AI entity at the scene.

Public Methods

GetSharedBehaviourTree()

Description: Get shared reference of behaviour tree.

Returns: Shared reference of behaviour tree.

Example:

BehaviourRunner runner = ai.GetComponent<BehaviourRunner>();
BehaviourTree behaviourTree = runner.GetSharedBehaviourTree();

SetSharedBehaviourTree(BehaviourTree tree)

Description: Set new shared behaviour tree reference.

Parameters: Reference of behaviour tree.

Example:

BehaviourRunner runner = ai.GetComponent<BehaviourRunner>();
BehaviourTree behaviourTree = runner.SetSharedBehaviourTree(newTree);

GetBehaviourTree()

Description: Associated instance of behaviour tree.

Returns: Associated (local) instance of behaviour tree created by runner after loading.

Example:


GetSharedBlackboard()

Description: Get shared reference of blackboard

Returns: Shared reference of blackboard.

Example:


GetBlackboard()

Description: Associated instance of blackboard.

Returns: Associated (local) instance of blackboard created by runner after loading.

Example:


Protected Virtual Methods

Use the following methods only for overriding when inheritance, it is not recommended not to call these methods manually.

Awake()

Description: Called when an enabled script instance is being loaded.

Example:


Start()

Description: Called on the frame when a script is enabled, just before any of the Update methods are called the first time.

Example:


Update()

Description: Called every frame, if the Behaviour is enabled.

Keep in mind it's Unity pipeline update call, not of selected behaviour tree update mode.

Example:


FixedUpdate()

Description: Called every fixed frame-rate frame. 0.02 seconds (50 calls per second) is the default time between calls, if the Behaviour is enabled.

Keep in mind it's Unity pipeline fixed update call, not of selected behaviour tree update mode.

Example:


LateUpdate()

Description: Called every frame, if the Behaviour is enabled after all Update calls.

Keep in mind it's Unity pipeline late update call, not of selected behaviour tree update mode.

Example:


OnDestroy()

Description: Called when an enabled script instance is being destroyed.

At this point, the associated instance of the behavior tree and the blackboard is still present and can be safely invoked.

Example:


OnDrawGizmos()

Description: Implement if you want to draw gizmos that are also pickable and always drawn.

Example:


OnDrawGizmosSelected()

Description: Implement to draw a gizmos if the object is selected.

Example:


Events Callbacks

OnCloneTreeCompleted

Description: Called when behaviour runner complete cloning of shared beahviour tree.

This callback can be used for making some custom actions with tree before starting the tree of specified AI.

Example:

Last updated