# Blackboard

{% hint style="info" %}
Variables are identified by a unique GUID in blackboards. You can still get a variable by it’s name but you have to make sure that the name is unique.
{% endhint %}

### Namespace

<pre class="language-csharp"><code class="lang-csharp"><strong>using FlowReactor.BlackboardSystem;
</strong></code></pre>

### GetVariableByName

```csharp
public T GetVariableByName<T> (string name) where T : FRVariable
```

Return a blackboard variable of type T by its name. \
Make sure that variable names are unique.

**Example - Get variable by its name**

```csharp
using FlowReactor;
using FlowReactor.BlackboardSystem;
 
// reference to blackboard
public BlackBoard variables;
 
// get variable value of type int with the name health
var _healthVariable = variables.GetVariableByName<FRInt>("health");
 
Debug.Log(_healthVariable.Value);
```

**Example - Modify variable value**

```csharp
using FlowReactor;
using FlowReactor.BlackboardSystem;
 
// reference to blackboard
public BlackBoard variables;
 
// First we get the variable reference from the blackboard of type FRInt
var _healthVariable = variables.GetVariableByName<FRInt>("health");
 
// Then we can simply modify the variable
_healthVariable.Value --;
 
Debug.Log(_healthVariable.Value);
```

### SaveToFile

```csharp
public void SaveToFile(string _fileName, SavePath _savePath, SaveFormat _format)
```

Saves the serialized blackboard to a file.

| Parameters          | Description                                       |
| ------------------- | ------------------------------------------------- |
| string \_fileName   | The file name which should be used for saving     |
| SavePath \_savePath | The save path, declared by the SavePath enum.     |
| SaveFormat \_format | The save format, declared by the SaveFormat enum. |

### LoadFromFile

```csharp
public void LoadFromFile(string _fileName, SavePath _savePath, SaveFormat _format)
```

Loads a serialized blackboard from a file.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://giantgrey.gitbook.io/flowreactor/api/blackboard.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
