docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BlackboardReference

    A reference to a Blackboard.

    Inheritance
    object
    BlackboardReference
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Behavior
    Assembly: Unity.Behavior.dll
    Syntax
    [Serializable]
    public class BlackboardReference

    Properties

    Blackboard

    An instantiated copy of the Blackboard asset to be used.

    Declaration
    public Blackboard Blackboard { get; }
    Property Value
    Type Description
    Blackboard

    Methods

    AddVariable<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 does not already exist within the blackboard's variables.

    Declaration
    public bool AddVariable<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

    GetVariable(string, out BlackboardVariable)

    Gets the variable associated with the specified name.

    Declaration
    public bool GetVariable(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.

    GetVariable(SerializableGUID, out BlackboardVariable)

    Gets a variable associated with the specified GUID.

    Declaration
    public bool GetVariable(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.

    GetVariableID(string, out SerializableGUID)

    Gets the ID of the variable associated with the specified name.

    Declaration
    public bool GetVariableID(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.

    GetVariableValue<TValue>(string, out TValue)

    Tries to get the variable's value associated with the specified name.

    Declaration
    public bool GetVariableValue<TValue>(string name, out TValue value)
    Parameters
    Type Name Description
    string name

    The name of the variable

    TValue value

    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.

    Type Parameters
    Name Description
    TValue

    The type of value stored by the variable

    GetVariable<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 GetVariable<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

    GetVariable<TValue>(SerializableGUID, out BlackboardVariable<TValue>)

    Gets a variable associated with the specified GUID and value type.

    Declaration
    public bool GetVariable<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

    SetVariableValue<TValue>(string, TValue)

    Sets the value of a blackboard variable matching the specified name and value type.

    Declaration
    public bool SetVariableValue<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

    SetVariableValue<TValue>(SerializableGUID, TValue)

    Sets the value of the variable associated with the specified GUID.

    Declaration
    public bool SetVariableValue<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

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)