Class Blackboard
A data structure holding variables used by the Muse Behavior Graph.
Inherited Members
Namespace: Unity.Muse.Behavior
Assembly: Unity.Muse.Behavior.dll
Syntax
[Serializable]
public class Blackboard
Properties
Variables
Variables stored in the blackboard.
Declaration
[JsonIgnore]
public IEnumerable<BlackboardVariable> Variables { get; }
Property Value
Type | Description |
---|---|
IEnumerable<BlackboardVariable> |
Methods
TryAddVariable<TValue>(string, TValue)
Adds a variable of a given type and value to the blackboard. A variable will only be added if one with the same name and type does not already exist within the blackboard's variables.
Declaration
public bool TryAddVariable<TValue>(string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable |
TValue | value | The value to assign to be assigned to the variable |
Returns
Type | Description |
---|---|
bool | Returns true if the variable is added and false if a matching variable already exists. |
Type Parameters
Name | Description |
---|---|
TValue | The type of value stored by the variable |
TryGetVariable(SerializableGUID, out BlackboardVariable)
Gets a variable associated with the specified GUID.
Declaration
public bool TryGetVariable(SerializableGUID guid, out BlackboardVariable variable)
Parameters
Type | Name | Description |
---|---|---|
SerializableGUID | guid | The GUID of the variable to get |
BlackboardVariable | variable | The variable associated with the specified GUID. |
Returns
Type | Description |
---|---|
bool | Returns true if a variable with a matching GUID was found and false otherwise. |
TryGetVariable(string, out BlackboardVariable)
Gets the variable associated with the specified name.
Declaration
public bool TryGetVariable(string name, out BlackboardVariable variable)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable |
BlackboardVariable | variable | Contains the value associated with the specified name, if the named variable is found; otherwise, the default value is assigned. |
Returns
Type | Description |
---|---|
bool | Returns true if a variable matching the name and type is found. Returns false otherwise. |
TryGetVariableID(string, out SerializableGUID)
Gets the ID of the variable associated with the specified name.
Declaration
public bool TryGetVariableID(string name, out SerializableGUID id)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable |
SerializableGUID | id | Contains the ID associated with the specified name, if the named variable is found; otherwise, the default value is assigned. |
Returns
Type | Description |
---|---|
bool | Returns true if a variable matching the name and type is found. Returns false otherwise. |
TryGetVariable<TValue>(SerializableGUID, out BlackboardVariable<TValue>)
Gets a variable associated with the specified GUID and value type.
Declaration
public bool TryGetVariable<TValue>(SerializableGUID guid, out BlackboardVariable<TValue> variable)
Parameters
Type | Name | Description |
---|---|---|
SerializableGUID | guid | The GUID of the variable to get |
BlackboardVariable<TValue> | variable | The variable associated with the specified GUID. |
Returns
Type | Description |
---|---|
bool | Returns true if a variable with a matching GUID and type was found and false otherwise. |
Type Parameters
Name | Description |
---|---|
TValue | The value type of the variable |
TryGetVariable<TValue>(string, out BlackboardVariable<TValue>)
Gets a variable associated with the specified name and value type. For values of type subclassed from UnityEngine.Object, use the non-generic method.
Declaration
public bool TryGetVariable<TValue>(string name, out BlackboardVariable<TValue> variable)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable |
BlackboardVariable<TValue> | variable | The blackboard variable matching the name and value type |
Returns
Type | Description |
---|---|
bool | Returns true if a variable matching the name and type is found. Returns false otherwise. |
Type Parameters
Name | Description |
---|---|
TValue | The type of value stored by the variable |
TrySetVariableValue<TValue>(SerializableGUID, TValue)
Sets the value of the variable associated with the specified GUID.
Declaration
public bool TrySetVariableValue<TValue>(SerializableGUID guid, TValue value)
Parameters
Type | Name | Description |
---|---|---|
SerializableGUID | guid | The guid associated with the variable |
TValue | value | The value to assign to the variable |
Returns
Type | Description |
---|---|
bool | Returns true if the value was set successfully and false otherwise. |
Type Parameters
Name | Description |
---|---|
TValue | The value type of the variable |
TrySetVariableValue<TValue>(string, TValue)
Sets the value of a blackboard variable matching the specified name and value type.
Declaration
public bool TrySetVariableValue<TValue>(string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable |
TValue | value | The value to assign to the variable |
Returns
Type | Description |
---|---|
bool | Returns true if a variable matching the name and type is found and set. Returns false otherwise. |
Type Parameters
Name | Description |
---|---|
TValue | The type of value stored by the variable |