User Guide
Last updated
Last updated
This section illustrates how to create the various assets within Unity.
Behavior Trees are essentially the Is processor and can make decisions and execute various branches based on the outcome of those decisions. Now an example of creating a simple bot will be shown:
Behavior Trees are essentially the AI's processor and can make decisions and execute various branches based on the outcome of those decisions.
Click on the Assets tab, then select Create/Renowned Games/Behavior Tree
The new Behavior Tree asset will be added to the Project Window which you can rename to your desired name.
Click on Create Node/Tasks/NavMesh/Random Position
Click on the Assets tab, then select Create/Renowned Games/Blackboard
The new Blackboard asset will be added to the Project Window which you can rename to your desired name.
To connect Blackboard to the Behavior Tree, click on the Behavior Tree we need and drag the desired Blackboard into the Behavior Tree inspector window where the Blackboard field will be.
In the Blackboard, we create a Key with the vector type and call it position.
To create a Key, click on the New Key tab.
In the window that opens, select the Key type.
An example of how it should turn out:
In the Random Position node inspector window, specify your new Key.
To create Move To node, we need to go to the desired Behavior tree and right-click the context menu.
Click on Create Node/Tasks/NavMesh/Move To
In the Move To node inspector window, specify position Key.
To create Wait, we need to go to the desired Behavior tree and right-click the context menu.
Click on Create Node/Tasks/Common/Wait
As in Move To Task, we add the position Key
In field Wait time specify 3 seconds.
To create Sequencer, we need to go to the desired Behavior tree and right-click the context menu.
Click on Create Node/Tasks/Composites/Sequencer
To link a node, you must pull the connection from the top or bottom of the node (indicated by a circle) to the center of another node.
We connect the remaining nodes in the same way:
To connect Behavior Tree to GameObject, we need to add a component to it Behavior Runner.
To do this, go to the inspector window of the necessary GameObject.
Clicks Add Component and searches Behavior Runner.
In the Behavior Runner field, connect our created Behavior Tree.
To create node, we need to go to the desired Behavior tree and right-click the context menu.
To save the position value we need to create .
So that our character can approach the generated position, we will create node.
To create a small delay, we will create node.
To link our years we need to add . Executes child nodes alternately.