> For the complete documentation index, see [llms.txt](https://mindcodeinteractive.gitbook.io/easy-build-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mindcodeinteractive.gitbook.io/easy-build-system/reference/building-part/building-behavior.md).

# Building Behavior

Reacts to building events with visual or gameplay effects.\
Each behavior runs custom logic alongside the [Building Part](/easy-build-system/reference/building-part.md) lifecycle.

***

### How Behaviors Work

Behaviors are optional components attached to a [Building Part](/easy-build-system/reference/building-part.md).\
They hook into the part’s lifecycle and handle placement, destruction, adjustment, and upgrades.\
Behaviors don't block actions, they respond to them after the fact.

Each behavior has a name, description, and a toggle to disable it.

***

### Built-in Behaviors

#### Animation Behavior

Plays animations during building events.\
Multiple event mappings can trigger different animations on the same behavior.

#### Debris Behavior

Spawns physics debris when triggered.\
Each variant can have its own debris prefab, sound effect, and spawn offset.\
Debris receives randomized force, torque, and is cleaned up after a configurable lifetime.

***

### Creating Custom Behaviors

Inherit from `BuildingBehavior` and implement `Initialize` and `Shutdown`:

```csharp
using MindCodeInteractive.EasyBuildSystem.Framework.Code.Runtime.Systems.Parts;
using MindCodeInteractive.EasyBuildSystem.Framework.Code.Runtime.Systems.Parts.Implementations.Behaviors.Abstracts;
using MindCodeInteractive.EasyBuildSystem.Framework.Code.Runtime.Systems.Parts.Implementations.Behaviors.Attributes;

[BuildingBehavior("My Custom Behavior", "Does something cool on placement.")]
public class MyCustomBehavior : BuildingBehavior
{
    public override void Initialize(BuildingPart part)
    {
        base.Initialize(part);
        // Subscribe to events or setup logic
    }

    public override void Shutdown()
    {
        // Unsubscribe and cleanup
    }
}
```

The `BuildingBehavior` attribute defines the name and description shown in the inspector.\
Your behavior will appear in the Add Behavior dropdown.


---

# 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://mindcodeinteractive.gitbook.io/easy-build-system/reference/building-part/building-behavior.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.
