# Key

```
class in RenownedGames.AITree / Inherits from ScriptableObject / Implements: IKeySynced, IKeyLocal, IKeyType, IEntityDescription
```

ScriptableObject storage of key in blackboard. Key also called as variable. Keys used in behaviour tree graph to read or write some information of nodes.

### Example

```csharp
public class Example : MonoBehaviour
{
    [SerializeField]
    private Key key;
    
    private void Awake()
    {
        Debug.Log(key.GetObjectValue());
    }
}
```

### Abstract Methods

```csharp
/// <summary>
/// System object reference value.
/// </summary>
public abstract object GetValueObject();
```

### Virtual Methods

```csharp
/// <summary>
/// Returns the name of the key.
/// </summary>
/// <returns>The name returned by ToString.</returns>
public virtual string ToString();
```

### Getter / Setter

```csharp
/// <summary>
/// System object reference value.
/// </summary>
object GetValueObject();

/// <summary>
/// Returns the name of the key.
/// </summary>
/// <returns>The name returned by ToString.</returns>
string ToString();

/// <summary>
/// This is used to determine if the Key will be synchronized across all instances of the Blackboard.
/// </summary>
bool IsSync();

/// <summary>
/// This is used to determine if the Key will be localy used in node.
/// </summary>
bool IsLocal()

/// <summary>
/// System value type of key.
/// </summary>
Type GetValueType();

/// <summary>
/// Detail description of key.
/// </summary>
string GetDescription();

/// <summary>
/// Blackboard category of key.
/// </summary>
string GetCategory();
```

### Events

```csharp
/// <summary>
/// Called when the key value has been changed.
/// </summary>
event Action ValueChanged;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://renownedgames.gitbook.io/ai-tree/api/runtime/key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
