# 11 Scriptable Object Blackboard

This example shows you how to use a scriptable object Blackboard.

These files can be found in the /Examples/\[example] and /Blackboards/Examples folders.

## ScriptableObjectBlackboard.cs

```csharp
﻿using CrashKonijn.RabbitBlackboard.Contracts;
using UnityEngine;

namespace CrashKonijn.BlackboardPro.Blackboards.Examples
{
    [CreateAssetMenu(menuName = "Blackboard Pro/Examples/ScriptableObjectBlackboard")]
    public partial class ScriptableObjectBlackboard : BlackboardScriptable
    {
        private int startPlayerHealth = 100;
        private static int lowHealth(Signals.StartPlayerHealth startPlayerHealth) => (int) (startPlayerHealth.Value * 0.4f);
    }
}

```

## ScriptableBehaviour.cs

```csharp
﻿using System;
using CrashKonijn.BlackboardPro.Blackboards.Examples;
using UnityEngine;

namespace CrashKonijn.BlackboardPro.Examples._11_scriptable_object
{
    public class ScriptableBehaviour : MonoBehaviour
    {
        [Header("Make sure to view the ScriptableBlackboard\nin the example folder!\n\nThis behaviour binds events on play")]
        [SerializeField]
        private ScriptableObjectBlackboard blackboard;
        
        // You can still register events to the signals!
        private void OnEnable()
        {
            blackboard.LowHealthSignal.OnValueChanged.AddListener(OnLowHealthChanged);
            blackboard.StartPlayerHealthSignal.OnValueChanged.AddListener(OnStartPlayerHealthChanged);
        }

        private void OnDisable()
        {
            blackboard.LowHealthSignal.OnValueChanged.RemoveListener(OnLowHealthChanged);
            blackboard.StartPlayerHealthSignal.OnValueChanged.RemoveListener(OnStartPlayerHealthChanged);
        }
        
        private void OnLowHealthChanged(int value)
        {
            Debug.Log($"Low health changed to {value}");
        }

        private void OnStartPlayerHealthChanged(int value)
        {
            Debug.Log($"Start player health changed to {value}");
        }
    }
}
```


---

# 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://blackboard.crashkonijn.com/examples/11_scriptable_object_blackboard.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.
