Hey guys
How do i create a level in realitykit ? and how do i then load it in code ? is it a file i need to drag and drop into the xcode the same as .reality file i use for assets?
Thank you
Hello @just_some_game_dev, thank you for your question!
First, if you haven't already, download Reality Composer Pro. This is Apple's first party scene authoring tool for RealityKit, and is the right tool to use to build levels in a RealityKit game.
To get a better idea of how to build games using RealityKit using Reality Composer Pro, check out these sample projects:
- Chaparral Village: Building an immersive visionOS adventure game
- Designing no-code games with Reality Composer Pro 3
- Petite Asteroids: Building a volumetric visionOS game
These samples are focused on visionOS, but the principles of authoring RealityKit content in Reality Composer Pro and exporting as a .reality file is the same for visionOS, macOS, iOS, iPadOS, and tvOS. RealityKit works across all these platforms.
Placing level settings on individual entities that represent your levels sounds like the right approach! In RealityKit, you compose "levels" (and everything in your game) using entities and components. You can use Reality Composer Pro to build those entities, then you can export entities in a .reality file that you can load in your app (see the samples above for more details on how this works). If you were building a platformer game, you could build each level in your platform as an entity with lots of sub entities for enemies and props and things, and then export those levels in a .reality file that your game loads at runtime.
I hope that helps answer your question! Good luck!