What is a level file in reality kit ?

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

Answered by Vision Pro Engineer in 912563022

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:

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!

to anyone who had this queation. as far as i see there is no level.
you jsut change the entities of the enviornment and the settings of the graph. and you technically have a different level.

i ended up creating an array of entitis tha hold level settings. they are being loaded depends on a "level" number which is saved ina jason .

Accepted Answer

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:

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!