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
  • Flow Control
  • Notify observer
  • Observer Abort
  • Comparers
  1. Nodes

Decorators

Description of decorators properties.

Flow Control

Flow Control determines when the decorator checks its condition to either continue or stop executing a branch of the Behavior Tree. This includes options like On Value Change and On Result Change.

Notify observer

Notify observer - In which case should notify the observer?

Name
Description

On Value Change

This mode allows the decorator to react whenever the value of the variable it’s monitoring changes. It’s useful when the condition needs to be checked dynamically in real-time.

On Result Change

In this mode, the decorator only checks the condition when the result differs from the previous check. This means if the result changes from "true" to "false" or vice versa, only then will the decorator recheck the condition.

Examples:

  • On Value Change: An AI character is monitoring an enemy's health, and if the health changes, it may decide whether to continue attacking. If the value changes (e.g., the enemy’s health drops below a certain threshold), the Behavior Tree can make a new decision.

  • On Result Change: AI is tracking whether an enemy is within line of sight. If the enemy was visible and then disappears, this change will trigger a recheck and possibly switch the AI's behavior (e.g., from attacking to searching for the enemy).


Observer Abort

Observer abort - determine how and when the Behavior Tree can be interrupted if the decorator's condition changes. A decorator can abort the execution of the current branch or neighboring tasks.

Name
Description

None

Observation does not abort tasks.

Self

If the condition of the decorator changes (e.g., becomes false), the current branch of the tree is stopped, and the AI switches to another branch.

Low Priority

Tasks with lower priority (below in the tree) are aborted if the decorator's condition becomes false.

Both

Both the current branch and lower priority tasks are aborted.

Examples

  • None: The AI continues its current action, even if the condition monitored by the decorator has changed.

  • Self: If the AI is chasing an enemy, but the enemy goes out of sight, the condition becomes false, and the chase branch is aborted. The AI may switch to another action, like returning to patrol.

  • Low Priority: The AI is chasing an enemy, but a higher-priority condition occurs (e.g., detecting a more dangerous enemy). The chase behavior is interrupted, and the AI switches to deal with the new threat.

  • Both: The AI might be simultaneously engaged in chasing and monitoring for safety (e.g., watching for enemies behind). If one condition changes (e.g., the AI gets attacked from behind), both the current and lower-priority branches will be interrupted to switch the AI’s focus to defending itself.


Comparers

Comparers define how a decorator compares a variable’s value to a target value. This is similar to regular comparison operators, such as "equal", "greater than", "less than", etc. In Behavior Trees, this allows the AI to make decisions based on complex conditions.

Check box - only checks if bool value is true or false.

Example of how to select comparer for bool key is shown below.

Comparers below are valid for Int, Float, Short and Long keys.

  • Is Equal To

  • Is Not Equal To

  • Is Less Than

  • Is Less Than Or Equal To

  • Is Greater Than

  • Is Greater Than Or Equal To

Example of how to select comparer for numeric key is shown below.

String key comparers:

  • Is Equal To

  • Is Not Equal To

  • Contains

  • Not Contains

Example of how to select comparer for string key is shown below.

Comparers below are valid for Vector2 and Vector3 keys.

  • Is Equal To

  • Is Not Equal To

  • Is Less Than

  • Is Less Than Or Equal To

  • Is Greater Than

  • Is Greater Than Or Equal To

Example of how to select comparer for vector key is shown below.

Distance Threshold - distance from desired position reaching which counts as reaching desired position.

Transform key comparers:

  • Is Set

  • Is Not Set

Example of how to select comparer for transform key is shown below.

Examples

  • Equal: If the AI should only attack an enemy if its health is equal to 100%, the decorator will use "equal to 100%".

  • Not Equal: The AI can retreat to cover if its health is not full.

  • Greater Than: The AI may decide to attack only when its health is greater than 50%.

  • Less Than: The AI might flee or seek cover if its health drops below 20%.


Decorators in AI Tree offer a flexible way to control the flow of task execution, checking conditions based on variable or result changes, and interrupting current tasks depending on how conditions change. These properties allow you to configure complex behavioral systems for AI, making them more adaptive and realistic.

Last updated 6 months ago

Bool key comparer
Numeric key comparers
String key comparers
Vector key comparers
Vector key comparers (dropdown opened)
Transform key comparers