Decorator
You can add original condition judgment and loop processing by creating a Decorator script and describing what you want to do.
Creating a Decorator script file
- Right click at the place you want to create from the Project window.
- From the right-click menu, select “Create> Arbor> Behavior tree> Decorator C# Script”.
   
- Enter the file name and confirm
Function to be called
If you add the created Decotarot to the composite node or action node, each function of the script will be called.
- OnAwake
 It is called the first time the node becomes active.
- OnStart
 It is called when the node becomes active.
- OnAbort
 Called when the node is interrupted by the Decorator.
- OnEnd
 Called when the node exits.
- HasConditionCheck
 It is called to determine whether ConditionCheck is done or not.
 If ConditionCheck is not done, please override and return false.
 Default is true.
- OnConditionCheck
 It is called when condition judgment is performed.
 Please return true if it matches the condition, false if it does not match.
 Whether to abort or not is ultimately determined by AbortFlags.
- OnRepeatCheck
 It is called to determine whether to repeat if the node terminates normally.
 To repeat please return true.
 Default is false.
- OnFinishExecute
 It is called to change the execution result.
 By default, it returns the received result as it is.
- OnUpdate
 Called at the timing of BehaviourTree's Update().
 Whether it is called every frame or not depends on BehaviourTree's Update Settings.
- OnLateUpdate
 It is called at the timing of BehaviourTree's LateUpdate().
 Whether it is called every frame or not depends on BehaviourTree's Update Settings.
- OnFixedUpdate
 It is called at the timing of FixedUpdate() in BehaviourTree.
- OnGraphPause
 Called when a graph is paused while playing.
- OnGraphResume
 Called when a graph is resumed from pause.
- OnGraphStop
 Called when a graph stops playing.
- MonoBehaviour message functions
 For details, please see the MonoBehaviour Messages of Unity ScriptReference.
Call order
 
- If more than one Decorator is added to the node, it is called in order from the top.
- You can also use the callback method of MonoBehaviour other than OnEnable and OnDisable, but please be aware that Start () will be called after OnConditionCheck () etc.
Declaring fields
 
You can edit it in Arbor Editor by declaring a field with public or SerializedField attribute added to the created script.
|  |  | 
It is similar to editing a field from the Inspector.
For details, refer to the following Unity manual.
- Variables and the Inspector
- Script Serialization for more information.
Data flow
It is possible to input / output values by data flow.
For details, see Scripting : Data flow.
async/await
It supports asynchronous wait by async/await.
See async/await for more information.
Additional explanation
- The file name and class name must be the same.
- If the file is placed under a special folder such as Editor folder, it will not be recognized.
- The AddComponentMenu("") that is automatically given is to prevent it from being displayed in Inspector's Add Component.
- We do not support the behavior of adding directly to GameObjects without going through the graph.
- The C# script needs to be compiled to reflect the changes.
 If you have turned off Auto Refresh in Preferences, for example, you will need to manually do “Assets > Refresh” from the menu.
- MonoBehaviour's enabled is used internally for execution control, so please use the alternative behaviourEnabled.