Blackboard

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.

Namespace

using FlowReactor.BlackboardSystem;

GetVariableByName

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

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

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

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

Saves the serialized blackboard to a file.

LoadFromFile

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

Loads a serialized blackboard from a file.

Last updated