RealityKit ECS Systems
Quick Start
- First verify that a documented RealityKit component cannot solve the
problem; use
realitykit-visionos-developercomponent selection when unsure. - Use a custom
Componentfor per-entity state and a customSystemfor continuous or multi-entity behavior. - Register custom components and systems once during app startup before any scene, asset, or Reality Composer Pro content that depends on them loads.
- Keep per-frame work in systems, not SwiftUI body code or ad hoc timers.
- Load the full ECS guide only when implementing or debugging real custom ECS code.
Load References When
| Reference | When to Use |
|---|---|
| references/systemandcomponentcreation.md | Implement a complete custom component/system registration, query, and update-order pattern. |
| references/custom-components.md | Define custom per-entity data and registration behavior. |
| references/custom-systems.md | Implement custom systems, queries, per-frame behavior, and update loops. |
Cross-Routing
- Use
realitykit-visionos-developerfor general component choice, entity loading, input, attachments, anchoring, portals, sync, and localUSDStageComponent. - Use
realitykit-rendering-materialswhen custom ECS only exists to drive materials, lights, post-processing, LOD, splats, or other visual state. - Use
realitykit-animation-physicswhen custom ECS interacts with animation, character motion, navigation, collision, physics, particles, or cloth. - Use
realitykit-audio-spatialwhen systems coordinate entity-owned audio.
Guardrails
- Prefer documented components before custom ECS.
- Register before loading scenes that reference the custom types.
- Keep system queries narrow and update only the entities that need work.
- Do not store SwiftUI-only state in RealityKit components unless entity ownership is intentional.
- Summarize registration order and query shape when changing ECS code.
Output Expectations
Provide:
- why custom ECS is needed
- which ECS reference was used
- the component data model
- the system query and update cadence
- the registration location and runtime validation step