Documentation

Learn how to use NodeCanvas

Download PDF Version

The GraphOwner Component

The GraphOwner components are responsible for making an object behave based on a Behaviour Tree or an FSM, by either using the BehaviourTreeOwner, or the FSMOwner derived components. These components do not contain the graph itself, but they are rather assigned a graph.

  • To make a gameobject behave with a Behaviour Tree, you have to attach the BehaviourTreeOwner component to that gameobject.
  • To make a gameobject behaviour with an FSM, you have to attach the FSMOwner component.
  • You can attach both type if you want and any number of those on the same game object.

BTOwnerInspector

Once you have attached your GraphOwner component, you will need to assign it an actual graph. An assigned graph to an owner can either be Bound or an Asset.

  • A Bound Graph is local to the owner and is saved along with the gameobject. As such it is possible to have scene object references assigned within the graph if the owner is also within the scene.
  • An Asset Graph is a reference to a .asset file saved in your assets folder. The benefit of this, is that such a graph can be assigned to any number of different owners, but the downside is that you can’t have scene object references assigned within it (this is a typical Unity restriction).

You always have the option to Bind an Asset graph, or to Save a Bound graph as an Asset file at any time through the editor GUI, so you don’t have to worry about this too much from the start.

All GraphOwner components have two common options for you to set in the inspector, those being the OnEnable and the OnDisable action, which respectively represent what will happen when the gameobject is enabled and is disabled. By default the options are the Enable Behaviour and Disable Behaviour respectively, but you are free to change these if you so require.

Finally, whenever you attach a GraphOwner component, a Blackboard component is also attached automatically if there is none attached already. The Blackboard is used to store variables that can be used within any of the graphs attached on the same gameobject, but more on Blackboards and variables can be read in Using the Blackboard section later on. Only one Blackboard should be used per game object.

Yes No Suggest edit
10 of 10 users found this section helpful
Suggest Edit