Customize 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.

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 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;

public class TestDecorator : Decorator {
	public string myName;
	// The rest is omitted.

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

Privacy Preference Center

Your Privacy

This site uses cookies to display contents and advertisements tailored to users, provide social media functions, measure advertisement impressions and clicks. We also gather information on users' site usage status and provide them to social media, advertisement distribution and data analysis partners. Each partner may use this information in combination with other information that the user provided to each partner or other information gathered when the user used the service of each partner.

Analytics, Ads