Build, debug, and optimize RealityKit scenes for visionOS, including entity/component setup, rendering, animation, physics, audio, input, attachments, and custom systems. Use when implementing RealityKit features or troubleshooting ECS behavior on visionOS.
This skill provides comprehensive guidance for implementing RealityKit-based spatial experiences on visionOS. RealityKit uses an Entity Component System (ECS) architecture where entities are lightweight containers, behavior comes from components, and systems drive per-frame updates.
Goals
Enable developers to build immersive 3D experiences on visionOS using RealityKit
Provide clear guidance on when to use each component and system
Help developers understand ECS patterns and best practices
Support debugging and optimization of RealityKit scenes
Ensure proper integration with SwiftUI via RealityView
What This Skill Should Do
When implementing RealityKit features on visionOS, this skill should:
Guide component selection - Help you choose the right components for rendering, interaction, physics, audio, and animation needs
Provide system implementation patterns - Show how to create custom systems for continuous behavior
Offer code examples - Demonstrate common patterns like async asset loading, interactive entities, and custom systems
Highlight best practices - Emphasize proper async loading, component registration, and performance considerations
Warn about pitfalls - Identify common mistakes like using ARView on visionOS or blocking the main actor
Load the appropriate component or system reference file from the tables below for detailed usage, code examples, and best practices.
Information About the Skill
Core Concepts
Entities and Components
Entities are lightweight containers; behavior comes from components.
Prefer composition over inheritance and use custom Component + Codable when you need per-entity state.
Register custom components once with Component.registerComponent() before use.
Keep entity transforms and component updates on the main actor.
RealityView and Attachments
Use RealityView to bridge SwiftUI and RealityKit.
Load assets with Entity(named:) or Entity(contentsOf:) asynchronously and handle errors.
Always use ViewAttachmentComponent for SwiftUI overlays in 3D and avoid the RealityView attachments closure.
Systems and Queries
Use a custom System for continuous, per-frame behavior.
Query entities with EntityQuery + QueryPredicate and process them in update(context:).
Use SystemDependency to control update order when multiple systems interact.
Components Reference
Use this table to decide which component reference file to load when implementing RealityKit features: