> For the complete documentation index, see [llms.txt](https://renownedgames.gitbook.io/ai-tree/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://renownedgames.gitbook.io/ai-tree/api/runtime/blackboard.md).

# 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**

```csharp
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

<pre class="language-csharp"><code class="lang-csharp"><strong>// Try get key by name with specified type, only in this blackboard.
</strong>// 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&#x3C;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&#x3C;T>(string name, out T value);

// Get list of all keys in this blackboard and parents.
List&#x3C;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);
</code></pre>

### Enumerators

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