Menu in shared space that lets you enter Fully Immersive Mode rather than immediately entering

Just received some feedback from an Apple employee - they recommended not launching the user into VR / Fully Immersive mode as soon as launching the app. Instead, offering a SwiftUI menu that lets the user enter when they choose. Because VR is rendered with Metal it seems this may not be possible - but thinking from first principles, we should be able to see a SwiftUI ContentView() first, that runs all the code for launching the Metal fully immersive app when the user presses a button.

This is possible, but not officially supported by Unity. You can modify the generated Xcode project to change UnityMain.swift and Info.plist and modify how the app is launched. You may want to try building the Xcode template project for metal rendering in visionOS, as it is set up this way.

I think @da_sxr was trying this in their app? There were some issues with audio when trying to do this, and it’s not trivial to set this up so that it automatically gets applied to the built Xcode project instead of having to manually change it every time you build out of Unity. Please feel free to submit this as an idea on our roadmap so we can consider it alongside other user-requested features.

Yeah, I did that some time ago. It is possible for sure, however, I did have to apply the changes manually whenever the Xcode project was overwritten. This only happens seldom, and a quick git revert does the trick, but it should of course be automated.

The main issue I encountered was with audio, but that issue has been (mostly) fixed now, so it might just work. I had to change the scene in UnityMain.swift to fit my needs and adjust some app flow code in, but it is definitely doable and is a much nicer user experience.

Do you have an example of how you managed to do this? Would super appreciate it!

No, sorry, the changes are long gone. But the basic idea is to hook into the and intersept the lifecycle events so that you can manually trigger load of the Unity player. That way you can make an entry scene and then manually kick loading of the player when needed.

1 Like