# Hierarchy of graph

Using graph hierarchy makes it easier to combine flexible AI etc. because you can split graph with rough behavior and detailed behavior.

# Create a subgraph

When using a subgraph, please create a state or action with the behavior script below.

## SubStateMachine

Have the child state machine and execute when the node becomes active.

- ArborReference : SubStateMachine(StateBehaviour)
- ArborReference : SubStateMachine(ActionBehaviour)

## SubStateMachineReference

Execute an external state machine such as prefab as a child state machine.

- ArborReference : SubStateMachineReference(StateBehaviour)
- ArborReference : SubStateMachineReference(ActionBehaviour)

## SubBehaviourTree

Have a child a behaviour tree and execute it when the node becomes active.

- ArborReference : SubBehaviourTree(StateBehaviour)
- ArborReference : SubBehaviourTree(ActionBehaviour)

## SubBehaviourTreeReference

Execute an external behaviour tree such as prefab as a child behaviour tree.

- ArborReference : SubBehaviourTreeReference(StateBehaviour)
- ArborReference : SubBehaviourTreeReference(ActionBehaviour)

# Argument of the graph

Parameters can be exchanged between the parent graph and the child graph.

## Creating parameters to pass

- Open the child graph in ArborEditor.
- Open the Parameters tab of the side panel.
- Create parameters for passing to and from the parent graph.
- Change the visible settings of Get and Set as necessary.

## Receive parameters in child graph

- Drag and drop the received parameters into the graph view.
- Select Get from the menu.
- Output values from the output slot of GetParameter, and use values at other nodes.

## Parameter setting in child graph

- Drag and drop parameters to be set to graph view.
- Select Set from the menu.
- Connect the setting value to the input slot.

## Pass parameters from the parent graph

- Open the parent graph in ArborEditor.
- Add parameters to be passed to the argument list of the subgraph.
- Set values from fixed values and input slots.

## Receives parameters from the child graph

- Add the parameters you want to receive in the argument list of the subgraph.
- Output values from the output slot and use values at other nodes.

## Argument update timing

You can specify when to update parameters.

- Click the update timing field.
- Select timing.

### Update timing

Name | Description
--- | ---
Enter | When the node becomes active and the child graph is updated when it starts playing
Execute | Updated every frame, when the child graph is executed

## Argument setting

For arguments, Get and Set can be set visually.

Please use it when you do not want to overwrite the parameter value without setting.

- Click the gear icon of the argument
- Argument setting in the setting window.

### Argument setting window

Label | Description
--- | ---
Set | Visible setting of input field
Get | Visible setting of output field

## When the child graph to be executed has not been confirmed

If the child graph to be executed by SubStateMachineReference etc. is not confirmed, it is necessary to specify the parameter name and type to be passed.

- Click the + button in the argument list.
- In the argument creation window, create an argument by inputting a parameter name and type.

### Argument creation window

Label | Description
--- | ---
Parameter Name | Name of the parameter. It must have the same name as the parameter of the child graph.
Parameter Type | Type of the parameter. It must be of the same type as the parameters of the child graph.
Reference Type (Parameter Type is Enum, Component, Variable only) | Value type of parameter It must be of the same type as the parameters of the child graph.
Set | Visible setting of input field
Get | Visible setting of output field

### Argument setting window

Label | Description
--- | ---
Parameter Name | Name of the parameter. It must have the same name as the parameter of the child graph.
Parameter Type | Type of the parameter. It must be of the same type as the parameters of the child graph.
Reference Type (Parameter Type is Enum, Component, Variable only) | Value type of parameter It must be of the same type as the parameters of the child graph.
Set | Visible setting of input field
Get | Visible setting of output field