# Data flow

Arbor has a function to pass data between nodes of the graph.

# Data flow

Connecting data input / output slots allows you to take advantage of data flow.

## Example

In the example using the built-in script, the following data flow can be easily assembled.

1. InstantiateGameObject instantiated prefab.
2. Output instantiated GameObject.
3. Get the Rigidbody component with Rigidbody.Get.
4. Add force with AddForceRigidbody to the received Rigidbody.

Data flow can be used in BehaviourTree as well.

## Reference link

- StateBehaviour : InstantiateGameObject
- StateBehaviour : AddForceRigidbody
- Calculator : Rigidbody.Get

# How to use data slots

## Connect

- Drag the data slot field.
- Drop into a pair of slots of the same type.

## Diconnect

- Right click on the connection line.
- Select “Disconnect”

# FlexibleField

In the fields of the FlexibleField related class, you can select multiple reference methods, so you can flexibly set values.

## Selection type

- Click the button next to the field.
- Select type.

## Reference types

### FlexibleType

Type that can be selected by FlexibleVector3 etc.

{< img_fluid src=“images/FlexibleField_FlexibleType.png” >}}

Item | Contents
--- | ---
Constant | Constant value.
Parameter | Refer to parameters. For parameters, see the Manual : ParameterContainer.
DataSlot | Input slot of data.

### FlexiblePrimitiveType

A type that can be selected by a numeric type such as FlexibleInt.

Item | Contents
--- | ---
Constant | Constant value.
Parameter | Refer to parameters. For parameters, see the Manual : ParameterContainer.
Random | Randomly obtain from the specified range.
DataSlot | Input slot of data.

### FlexibleSceneObjectType

A selectable type of scene object type such as FlexibleGameObject.

Item | Contents
--- | ---
Constant | Constant value.
Parameter | Refer to parameters. For parameters, see the Manual : ParameterContainer.
DataSlot | Input slot of data.
Hierarchy | Reference from the graph hierarchy. Self References the GameObject that owns the graph. RootGraph If you are hierarchizing the graph, refer to the GameObject that owns the root graph. If the self graph is a root, it refers to the GameObject of the self graph.

## Drag and drop settings

Regardless of the selected type, Parameter and DataSlot (GameObject and Component are also acceptable for scene object types) can be set by direct drag and drop.

- Drag the parameters you want to set.
- Drop to Drop field.

# DataLink attribute

For fields using DataLink attributes, you can use constant or input from data flow. Also, when entering from the data flow, you can specify at what timing the value should be updated.

## Specifying timing

- When an input slot is connected to another output slot, a timing specification field is displayed.
- Specify the type.
- (If it is not displayed, you can not change it because the script has specified the timing.)

## Timing type

Item | Contents
--- | ---
Noting | Do not update.
Everything | Always update.
Enter | Update when entering a node.
Execute | Update when the node is executed.
Manual | Update from script to arbitrary timing.

# Reroute node

Using the reroute node makes it easier to organize the data flow lines.

## Create a reroute node and connect

- Drag the data slot field.
- Drop at the position in the graph where you want to create a reroute node
- Select “reroute” in the menu

## Insert reroute node

- Right-click the position where you want to create a reroute node on the connection line.
- Select “reroute” in the menu.

## Change direction of reroute node

- Select reroute node to change direction
- Drag the direction icon to change it.

# About connection line

## Show Value

If you hover over the connection line while playing, the current value will be displayed.

Also, if you select “Always show data value” from the right-click menu of the connection line, it will be displayed even without mouseover.

If you want to display the values of all the connection lines, selecting “Show all data values” from the “Debug” menu on the toolbar will toggle.

## Right click menu

Right-click on the connection line to display the menu.

Item | Contents
--- | ---
Always show data values | Always show data values when playing.
Reroute | Insert the reroute node.
Disconnect | Disconnect it.

# About calculator node

A calculator node is a node for calculation with data input / output.

You can do numerical calculations and access fields for output.

## Creating a calculator node

- Right-click the appropriate position of Arbor Editor.
- Click on the “Create Calculator”.
- Select the calculator node you want to create from the list.

## Built-in Calculator

Calculator nodes that are used frequently are prepared from the beginning.

Arbor Reference : Calculator Reference

# Scripting

You can also use data flow from your own scripts.

For details, see “Scripting : Data flow”.

Scripting : Data flow