BehaviorDesigner

m

Behavior Tree Component

//stores your behavior tree and acts as the interface between Behavior Designer and the tasks

Tasks

//At the highest level a behavior tree is a collection of tasks

//Tasks have a similar API to Unity’s MonoBehaviour

The following flow chart is used when executing the task

(funcs)

public

virtual

void

OnAwake();

// OnAwake is called once when the behavior tree is enabled. Think of it as a constructor

OnStart();

// OnStart is called immediately before execution. It is used to setup any variables that need to be reset from the previous run

OnEnd();

// OnEnd is called after execution on a success or failure.

OnPause(bool paused);

// OnPause is called when the behavior is paused and resumed

GetPriority();

// The priority select will need to know this tasks priority of running

OnBehaviorComplete();

// OnBehaviorComplete is called after the behavior tree finishes executing

OnReset();

// OnReset is called by the inspector to reset the public properties

OnDrawGizmos();

// Allow OnDrawGizmos to be called from the tasks

TaskStatus

OnUpdate();

// OnUpdate runs the actual task

Behavior

Owner;

// Keep a reference to the behavior that owns this task

(props)

string???

name

comment

bool???

instant

//This is an easy way to throttle the behavior tree.

//Uncheck the instant task it will now wait a update tick before the next task gets executed.

//Else when a task returns success or fail it immediately moves onto the next task within the same update tick

Concept

Tasks

(type)

Action

// This task is going to be changing the game state

(updating runtime gameobject, transform, properties...etc)

(List)

Composites

// Composite tasks are parent tasks that hold a list of child tasks.

// For example, one composite task may loop through the child tasks sequentially while another task may run all of its child tasks at once.

// The return status of the composite tasks depends on its children.

// Every composite task holds the property which specifies if conditional aborts should be used.

???

(List)

(and)

Sequence

// The sequence task is similar to an "and" operation.

Parallel

// "And" comparison, but the parallel task will run all of its children tasks simultaneously versus running each task one at a time.

Random Sequence

// The difference is that the random sequence class will run its children in a random order.

(args)

(or)

Selector

// The selector task is similar to an "or" operation.

Parallel Selector

// The difference is that the parallel task will run all of its children tasks simultaneously versus running each task one at a time.

Priority Selector

// The higher priority tasks have a higher chance at being run first.

Random Selector

// The difference is that the random selector class will run its children in a random order.

(args)

Selector Evaluator

// The selector evaluator is a selector task which reevaluates its children every tick.

Conditional

// This task will not be changing game state and is just checking the status of the game

(sightline, audio radius, collision, physics...etc)

(List)

Physics

Has

Entered

Collision

Collision2D

Trigger

Trigger2D

Exited

Collision

Collision2D

Trigger

Trigger2D

(var)

Compare Property Value

(args)

Compare Field Value

Random Probability

Decorators

// The decorator task is a wrapper task that can only have one child.

// The decorator task will modify the behavior of the child task in some way. For example, the decorator task may keep running the child task until it returns with a status of success or it may invert the return status of the child.

(misc)

Basic Tasks

(built in Unity MonoBehavior???)

Third Party

Entry Task

// The entry task is a task that is used for display purposes within Behavior Designer to indicate the root of the tree. It is not a real task and cannot be used within the behavior tree.

???

(variable)

(global)

(shared)