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

## Types

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

# 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