<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Scene/publisher(for:on:componentType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5SceneC9publisher3for2on13componentTypeAC9PublisherVy_xGxm_AA11EventSource_pSgAA9Component_pXpSgtAA0J0RzlF"
  },
  "title" : "publisher(for:on:componentType:)"
}
-->

# publisher(for:on:componentType:)

Returns a `Publisher` for events of the specified type in a `Scene`.

```
@MainActor @preconcurrency func publisher<E>(for event: E.Type, on sourceObject: (any EventSource)? = nil, componentType: (any Component.Type)?) -> Scene.Publisher<E> where E : Event
```

## Parameters

`event`

The event type to subscribe to. For example, [`SceneEvents.Update`](/documentation/RealityKit/SceneEvents/Update).

`sourceObject`

The event source – usually the entity you are interested in. `nil` to
listen all events of this type that occur in the scene.

`componentType`

The component type, or `nil` for all (for ComponentEvents).

## Return Value

A `Publisher` for events of the specified type.

---

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)