> For the complete documentation index, see [llms.txt](https://sniveler-code.gitbook.io/dots/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sniveler-code.gitbook.io/dots/project-ai-behavior-architect/section-6/creating-your-first-custom-node.md).

# 💻 Creating Your First Custom Node

While AI Behavior Architect provides powerful built-in nodes, the true strength of the framework is how easily you can write custom DOTS logic.

You write standard C# structs, and the framework’s Code Generator automatically writes the ECS boilerplate, creates the `ISystem`, queries the chunks, and schedules the multithreaded Burst jobs for you.

#### Step-by-Step: Creating an Action

1. Create a new C# script in your project (e.g., `LogMessageAction.cs`).
2. Define a partial struct (this is required because the code generator will create the other half of the struct).
3. Add the `[BtCustom]` attribute above the struct. This registers it in the visual editor.
4. Create a private `NodeStatus Process()` method. This is where your logic executes.

```csharp
using SnivelerCode.AiBehavior.Runtime.Attributes;
using SnivelerCode.AiBehavior.Runtime.Components;

namespace MyGame.AI
{
    // The string dictates the path in the Editor's Node Search Window
    [BtCustom("Debug/Log Action")]
    public partial struct LogMessageAction
    {
        // The generator automatically calls this Process method inside a Burst job
        private NodeStatus Process()
        {
            // Note: Because this runs in a Burst job, you must use Unity.Burst logging, 
            // not UnityEngine.Debug.Log!
            SnivelerCode.AiBehavior.Runtime.Utils.BtLogger.BurstLog()
                .Append("Hello from Burst!")
                .Log();

            return NodeStatus.Success;
        }
    }
}
```

1. Save the script.
2. Open the `Behavior Editor`, right-click, find `CustomAction` and search for `Debug/Log Action`. It is now a fully functional node!


---

# 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://sniveler-code.gitbook.io/dots/project-ai-behavior-architect/section-6/creating-your-first-custom-node.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.
