Service
By creating a Service script, you can add your own update processing etc. by describing the processing you want to do.
Create Service 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> Service C# Script”.
- Enter the file name and confirm
Function to be called
When you add the created Service 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. - OnUpdate
Called each time the node is active. For details about the execution timing, see Behavior tree's UpdateSettings.
Arbor Reference : BehaviourTree - OnAbort
Called when the node is interrupted by the Decorator. - OnEnd
Called when the node exits.
Important point
- For enabled of MonoBehaviour are used internally already for execution control, please use the behaviourEnabled to be a substitute.
Call order
- If more than one service is added to the node, it is called from the top in order.
- You can also use the callback method of MonoBehaviour other than OnEnable and OnDisable, but please be aware that Start() will be called after the first OnUpdate().
Declaring variables
You can edit it in Arbor Editor by declaring a field with public or SerializedField attribute added to the created script.
|
|
Data flow
It is possible to input / output values by data flow.
For details, see “Scripting: Data flow”.