Customize Service


This is the documentation for Arbor 3.2.4 and earlier.

See Arbor Documentation for the latest documentation.

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.
    http://arbor-docs.caitsithware.com/en/components/behaviourtree.html
  • OnAbort
    Called when the node is interrupted by the Decorator.
  • OnEnd
    Called when the node exits.

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.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Arbor;
using Arbor.BehaviourTree;

[AddComponentMenu("")]
public class TestService : Service
{
	public string myName;
	// The rest is omitted.
}

You can also use CalculatorSlot and Flexible classes as well as StateBehaviour.