---
title: "subscribe(to:_:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/entityaction/subscribe(to:_:)"
---

# subscribe(to:_:)

Subscribes to an action event.

## Declaration

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

## Discussion

Discussion For example, you can call this method to subscribe to the update event, which the system calls each frame it evaluates the action: struct MyAction: EntityAction {     ... } MyAction.subscribe(to: .updated) { event in     // RealityKit calls this closure in lock step as it     // processes each animation frame. }
