<!--
{
  "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/subscribe(to:_:)-3p0pj",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation18BehaviorTreeActionPAAE9subscribe2to_yAA0E9EventTypeV_yAA0eH0VyxGctFZ"
  },
  "title" : "subscribe(to:_:)"
}
-->

# subscribe(to:_:)

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

```
@MainActor @preconcurrency static func subscribe(to eventType: ActionEventType, _ handler: @escaping @MainActor (ActionEvent<Self>) -> Void)
```

## Discussion

When the handler doesn’t return a value, the action status is preserved: the value already
in `actionStatusPointer` at the time the handler is called is read and written back,
leaving the behavior tree’s status unchanged.

---

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)