# 01 Basic

This is a basic example showing how to create a simple blackboard.

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

![Example 01 Basics editor](/files/rHLmUiITTBMPEaomL0Kg)

## BasicBlackboard.cs

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

namespace CrashKonijn.BlackboardPro.Blackboards.Examples
{
    // This attribute will enable viewing the generated source for the blackboard in the inspector.
    // Only enable this if you can't use Rider or Visual Studio to view the generated source.
    [DebugBlackboard]
    public partial class BasicBlackboard : BlackboardBehaviour
    {
        // This will generate a HealthSignal containing an int value on this same class.
        // Even though you can't see it in this file, it has been added in another 'partial'.
        // The source generators are automatically run by Unity's compilation process!

        // To view the other partial/generated code you can do the following:
        // In Rider: ctrl + click on the classname
        // In Visual Studio: Place your cursor on the classname and press F12. The declarations window should show and you can select the generated partial. The file is <FileName>_<lite|pro>_generated.cs.
        private int health = 100;
    }
}

```

## BasicHealthBehaviour.cs

```csharp
﻿using CrashKonijn.RabbitBlackboard.Contracts;
using UnityEngine;
using BasicBlackboard = CrashKonijn.BlackboardPro.Blackboards.Examples.BasicBlackboard;

namespace CrashKonijn.BlackboardPro.Examples._01_basic
{
    [RequireComponent(typeof(BasicBlackboard))]
    public class BasicHealthBehaviour : MonoBehaviour
    {
        /* Simple hack to show a button in the editor */
        [Header("Removes 10 health.")]
        [Button(nameof(DoDamage))]
        public string doDamageButton;

        /* Simple hack to show a button in the editor */
        [Header("Adds 10 health")]
        [Button(nameof(Heal))]
        public string healButton;

        private BasicBlackboard blackboard;

        public BasicBlackboard Blackboard
        {
            get
            {
                if (this.blackboard == null)
                {
                    this.blackboard = this.GetComponent<BasicBlackboard>();
                }

                return this.blackboard;
            }
        }

        public void DoDamage()
        {
            this.Blackboard.Health -= 10;
        }

        public void Heal()
        {
            this.Blackboard.Health += 10;
        }
    }
}

```


---

# 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/01_basics.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.
