Blackboard

Type description and basic instructions.

class in RenownedGames.AITree / Inherits from ScriptableObject

ScriptableObject storage of keys which can be used in beahviour tree.

Example

public class Example : MonoBehaviour
{
    [SerializeField]
    private Blackboard blackboard;
    
    private void Awake()
    {
        // Iterate through all keys in blackboard and show them in Unity console.
        foreach(Key key in blackboard.Keys)
        {
            Debug.Log($"Name: {key.name}, Description: {key.GetDescription()}");
        }
    }
}

Getter / Setter

// Try get key by name with specified type, only in this blackboard.
// name: Name of key.
// value: Output reference of key.
// returns: True if key with same name and type found. Otherwise false.
bool TryGetKey(string name, out Key value);

// Try get key by name with specified type, only in this blackboard.
// T: Type of Key.
// name: Name of key.
// value: Output reference of key.
// returns: True if key with same name and type found. Otherwise false.
bool TryGetKey<T>(string name, out T value);

// Try find key by name with specified type, 
// in this blackboard and including all parents.
// name: Name of key.
// value: Output reference of key.
// returns: True if key with same name and type found. Otherwise false.
bool TryFindKey(string name, out Key value);

// Try find key by name with specified type, 
// in this blackboard and including all parents.
// T: Type of Key.
// name: Name of key.
// value: Output reference of key.
// returns: True if key with same name and type found. Otherwise false.
bool TryFindKey<T>(string name, out T value);

// Get list of all keys in this blackboard and parents.
List<Key> GetAllKeys();

// Check if blackboard contains key with same name.
// name: Name of searching key.
// includeParents: Search key including in parent blackboards.
bool Contains(string name, bool includeParents = true);

// Clone this blackboard.
Blackboard Clone();

// Check this blackboard nested of other.
// blackboard: Blackboard to compare.
bool IsNested(Blackboard blackboard);

// Add new key to blackboard.
void AddKey(Key key);

// Remove key from blackboard.
void DeleteKey(Key key);

Enumerators

// Iterate through all keys in blackboard.
IEnumerable<Key> Keys;

Last updated