AI Tree
  • 🏡Home
  • ⭐Getting Started
  • Basic
    • Behaviour Tree
      • Node
      • Decorator
      • Service
    • Blackboard
      • Key (Variable)
    • Perception System
    • Environment Query System
    • Quick Start
    • User Guide
    • Shortcuts
  • Navigation
    • Building a NavMesh
  • Nodes
    • Composite
      • Sequencer
      • Selector
        • Selector
        • Random Selector
      • Parallel
        • Parallel
        • Parallel Selector
        • Parallel Complete
    • Tasks
      • Animator
        • Cross Fade
        • Cross Fade in Fixed time
        • Set Bool
        • Set Float
        • Set Integer
        • Set Trigger
      • Audio
        • Audio Mute
        • Audio Pause
        • Audio Play
        • Audio Stop
        • Play Random Sound
        • Play Sound
        • Set Audio Clip
        • Set Audio Loop
        • Set Audio Pitch
        • Set Audio Volume
      • Audio Source
        • Play Clip At Point
      • Debug
        • Debug Log
        • Debug Draw Line
        • Debug Draw Ray
      • Common
        • Wait
        • Set Key
        • Run Behaviour
        • Wait Blackboard Time
        • Finish With Result
      • EQS
        • Run EQS Query
      • Game Object
        • Activate
        • Add Component
        • Create Object
        • Destroy Component
        • Destroy Object
        • Destroy Self
        • Detach Children
        • Find
        • Find Child
        • Find Closest
        • Get Child
        • Get Child Count
        • Get Distance
        • Get Parent
        • Get Root
        • Get Tag
        • Get Name
        • Set Parent
        • Set Tag
      • Math
        • Bool Flip
        • Bool Operator
        • Float Abs
        • Float Clamp
        • Float Operator
        • Int Abs
        • Int Clamp
        • Int Operator
        • Random Bool
        • Random Float
        • Random Int
        • Sample Curve
        • Get ACos
        • Get ASin
        • Get Atan
        • Get Atan2
        • Get Atan2 From Vector2
        • Get Atan2 From Vector3
        • Get Cos
        • Get Sin
        • Get Tan
      • Movement
        • Move Towards
        • Way Point
      • NavMesh
        • Move To
        • Random Position
      • Object
        • Destroy
        • Instantiate
      • Perception System
        • Detection Signal
      • Physics
        • Box Cast
        • Capsule Cast
        • Line Cast
        • Ray Cast
        • Sphere Cast
      • Physics2D
        • Box Cast 2D
        • Capsule Cast 2D
        • Line Cast 2D
        • Ray Cast 2D
        • Sphere Cast 2D
      • Player Prefs
        • Delete All
        • Delete Key
        • Get Float
        • Get Int
        • Get String
        • Set Float
        • Set Int
        • Set String
      • Quaternion
        • Angle Axis
        • Euler
        • From To Rotation
        • Get Euler Angles
        • Inverse
        • Multiply
        • Multiply By Vector
      • Rigidbody
        • Add Explosion Force
        • Add Force
        • Add Force At Position
        • Add Relative Force
        • Add Relative Torque
        • Add Torque
        • Move Position
        • Move Rotation
        • Sleep
        • Wake Up
      • Rigidbody2D
        • Add Force 2D
        • Add Force At Position 2D
        • Add Relative Force 2D
        • Add Torque 2D
        • Move Position 2D
        • Move Rotation 2D
        • Sleep 2D
        • Wake Up 2D
      • Transform
        • Get Angle To Target
        • Get Position
        • Get Rotation
        • Inverse Transform Direction
        • Set Scale
        • Inverse Transform Point
        • Transform Direction
        • Transform Point
      • Vector2
        • Add
        • Add XY
        • Clamp Magnitude
        • Get Length
        • Get XY
        • Invert
        • Select Random
        • Set Value
        • Set XY
      • Vector3
        • Add
        • Add XYZ
        • Clamp Magnitude
        • Get Length
        • Get XYZ
        • Invert
        • Select Random
        • Set Value
        • Set XYZ
      • Unity
        • Debug
        • Send Message
        • Find Transfrom
    • Decorators
      • Blackboard Condition
      • Compare Blackboard Keys
      • Conditional Loop
      • Cone Check
      • Inverter
      • Is At Location
      • Loop
      • Has Path
      • Object Tag Condition
      • One Time Execution
      • Succeeder
      • Time Limit
  • Perception System
    • Quick Start
    • Useful Components
      • AI Perception Blackboard
      • AI Perception Source
    • Useful Nodes
  • Environment Query System
    • Quick Start
    • Items
    • Useful Components
      • EQS Tester
    • Useful Objects
      • Environment Query
        • Generator
          • Circle
          • Cone
          • Donut
          • Grid
        • Trace Mode
          • Layer
          • NavMesh
        • Tests
          • Distance
          • Dot
          • Has Path
          • Overlap
          • Slope
          • Trace
    • Useful Nodes
  • API
    • Overview
    • User Scripting
      • Custom Task
      • Custom Key
      • ToolbarItem attribute
    • Runtime
      • BehaviourTree
      • BehaviourRunner
      • Blackboard
      • Key
      • Key<T>
      • KeyQuery
      • KeyQuery<T>
      • KeyReceiver
      • KeyReceiver<T>
      • Task Node
      • Decorator Node
      • Condition Decorator
      • Observer Decorator
      • Service Node
      • Interval Service Node
      • NodeContentAttribute
      • AIPerceptionConfig
      • EQGenerator
      • EQTraceMode
      • EQTest
  • INTEGRATIONS
    • Adventure Creator
    • A* Pathfinding Project Pro
      • Move To
    • Dialogue System for Unity
      • Lua Condition Decorator
      • Lua Run
      • Dialogue Behaviour Handler
      • Blackboard Saver
      • Lua Functions
    • Mirror Network
      • Quick Start
      • Network Instantiate
      • Network Destroy
      • Network Play Clip At Point
      • Network Debug
    • Photon Network
      • Quick Start
      • Network Instantiate
      • Network Destroy
      • Network Play Clip At Point
      • Network Debug
    • PlayMaker
      • Set Runner Active
      • Set Perception Active
      • Get Blackboard Key
      • Set Blackboard Key
    • Sensor Toolkit 2
      • Sensor Config
    • Ultimate Horror FPS KIT
      • Quick Start
      • Apply Damage
      • Animator Event Disabler
    • Odin Inspector
Powered by GitBook
On this page
  • Creating Behavior Tree
  • Creating Random Position Task
  • Creating Blackboard
  • Connecting Blackboard in Behavior Tree
  • Creating Keys for Blackboard
  • Creating Move To Task
  • Creating Wait Task
  • Creating Sequencer
  • Linking Nodes
  • Connecting Behavior Tree with GameObject
  1. Basic

User Guide

Last updated 2 years ago

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:

Creating Behavior Tree

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

Also you can right-click in the Project Window, 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.

Creating Random Position Task

Click on Create Node/Tasks/NavMesh/Random Position

Creating Blackboard

Click on the Assets tab, then select Create/Renowned Games/Blackboard

Also you can right-click in the Project Window, 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.

Connecting Blackboard in Behavior Tree

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.

You can also add it by clicking on the field with blackboard and select it from all the blackboards in the project.

Creating Keys for Blackboard

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.

Creating Move To Task

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.

Creating Wait Task

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.

If you don't want to create a Key in the Blackboard, then you can click on the flag next to the field and enter your fixed value.

Creating Sequencer

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

Linking Nodes

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.

Connecting nodes in Behavior Trees only work by connecting an output to an input (you cannot connect from an input to an output).

We connect the remaining nodes in the same way:

Connecting Behavior Tree with GameObject

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.

Random Position
Blackboard
Move To
Wait
Sequencer
Behavior Tree
Creating Behavior Tree
Behavior Tree Name
Creating Blackboard
Blackboard name
Behavior Tree Inspector
Connecting Blackboard in Behavior Tree
Creating new Key
Selecting Key types
Creating position Key
Assigning new Key in Task
Creating Move To Task
Assigning new Key in Task
Creating Wait Task
Filling Wait Time field
Now our tree looks like this.
Creating Sequencer
Link example
Links example