> For the complete documentation index, see [llms.txt](https://blackboard.crashkonijn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blackboard.crashkonijn.com/examples/09_object_lists.md).

# 09 Object Lists

This example shows you how to use object lists in a blackboard.

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

![Example 09 Object Lists editor](/files/OfFelNHzMgrkmewAccq7)

## ObjectListBlackboard.cs

```csharp
using System;
using System.Collections.Generic;
using System.Linq;
using CrashKonijn.RabbitBlackboard.Contracts;

namespace CrashKonijn.BlackboardPro.Blackboards.Examples
{
    [Serializable]
    public class SerializedChange
    {
        public int amount;
    }

    [Serializable]
    public partial class SignalChange : ISomeAreSignals
    {
        [Signal]
        private int amount;

        [Signal]
        private string name;
    }

    public partial class ObjectListBlackboard : BlackboardBehaviour
    {
        private int startHealth = 100;

        // Lists can be of any type
        private List<SerializedChange> serializedChanges;
        private List<SignalChange> signalChanges;

        // This is a computed property, showing health being equal to startHealth plus the sum of all changes.
        private static int serializedHealth(Signals.StartHealth startHealth, Signals.SerializedChanges changes) => startHealth.Value + changes.Value.Sum(x => x.amount);

        // WARNING: even though the type here has signals on its own. Change events are triggered by the VALUE of the signal.
        // This means that even when changing the amount of a SignalChange, the containing list won't trigger an event.
        private static int signalHealth(Signals.StartHealth startHealth, Signals.SignalChanges changes) => startHealth.Value + changes.Value.Sum(x => x.Amount);
    }
}

```

## ObjectListsHealthBehaviour.cs

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

namespace CrashKonijn.BlackboardPro.Examples._09_object_lists
{
    [RequireComponent(typeof(ObjectListBlackboard))]
    public class ObjectListsHealthBehaviour : 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;

        /* Simple hack to show a button in the editor */
        [Header("Clears the changes list")]
        [Button(nameof(Clear))]
        public string clearButton;

        private ObjectListBlackboard blackboard;

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

                return this.blackboard;
            }
        }

        public void DoDamage()
        {
            this.Blackboard.SignalChanges.Add(new SignalChange
            {
                Amount = -10,
            });
            this.Blackboard.SerializedChanges.Add(new SerializedChange
            {
                amount = -10,
            });
        }

        public void Heal()
        {
            this.Blackboard.SignalChanges.Add(new SignalChange
            {
                Amount = 10,
            });
            this.Blackboard.SerializedChanges.Add(new SerializedChange
            {
                amount = 10,
            });
        }

        public void Clear()
        {
            this.Blackboard.SignalChanges.Clear();
        }
    }
}

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://blackboard.crashkonijn.com/examples/09_object_lists.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
