<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/BehaviorTreeAction",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation18BehaviorTreeActionP"
  },
  "title" : "BehaviorTreeAction"
}
-->

# BehaviorTreeAction

A protocol that defines an action that a behavior tree action node can use.

```
protocol BehaviorTreeAction : EntityAction
```

## Overview

Conform to this protocol as:

```swift
struct CustomBehaviorTreeAction: BehaviorTreeAction, Codable {

    public var isReversible: Bool { false }
    public var isAdditive: Bool { false }
    public var animatedValueType: (any AnimatableData.Type)? { nil }

    // Add your action-specific properties, functions and subscriptions here.
}
```

## Topics

### Subscribing to events

[`static func subscribe(to: ActionEventType, (ActionEvent<Self>) -> ActionResult)`](/documentation/RealityKit/BehaviorTreeAction/subscribe(to:_:)-9mrvx)

Subscribes to a serializable action event and returns a `ActionResult`.

[`static func subscribe(to: ActionEventType, (ActionEvent<Self>) -> Void)`](/documentation/RealityKit/BehaviorTreeAction/subscribe(to:_:)-3p0pj)

Shadows the `EntityAction.subscribe(to:_:)` overload that takes a `-> Void` closure.

### Type Methods

[`static subscribe(to:_:)`](/documentation/RealityKit/BehaviorTreeAction/subscribe(to:_:))

Subscribes to a serializable action event and returns a `ActionResult`.

## Relationships

### Inherits From

[`EntityAction`](/documentation/RealityKit/EntityAction)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)