Simulator does not show up as run target

I am trying to port an existing AR Foundation app using ARKit to visionOS. I have enabled PolySpatial and visionOS in the XR Manager, and I am able to export the app to Xcode.

However, the visionOS simulator cannot be selected as a run target in Xcode. This works for the sample apps, though.

How does Xcode decide whether the simulator can be run or not?

1 Like

I have the same issue if I setup a fully immersive visionOS app “from scratch”, as described in the PolySpatial docs.

I added both the com.unity.polyspatial.visionos and com.unity.polyspatial.xr via Package Manager, activated PolySpatial and visionOS under the XR Management, switched to the visionOS runtime platform, added the sample scene and fixed all issues unser Project Validation. To my understanding, I should now get a working VR app showing a Skybox.

Export to Xcode works, but I cannot play the app in the visionOS simulator (doesn’t show up as a run target). Also, the Swift files haven’t been generated. The rest of the visionOS specific frameworks seem to be present.

Any idea what I might be missing here?

1 Like

Ok, I found out by comparing the Xcode build settings manually. It seems as if Unity sets the “supported platforms” setting to “xros” by default, which corresponds to the Device SDK. If I set it to “visionos” instead, the simulator becomes available. Setting the Target SDK in Unity to “Simulator SDK” does the trick as well.

This should be mentioned in the docs IMHO. The samples app uses “xrsimulator”, which Xcode seems to accept as well.

What is especially confusing here is that the docs state:

“Note: unlike iOS, there is no need to switch to a different SDK in Project Settings to run your content in the simulator. Simply select the RealityDevice simulator target in Xcode.”

However, I haven’t found out yet, why Unity won’t generate the Swift classes by default, and how I can control this?

Hv u tried visionOSTemplate-0.7.1? It seems like no matter what I changed “supported platforms” to xros or visionos or xrsimulator, the simulator option won’t show up as target.
I am using Xcode 15.2 beta, Unity 2022.3.15f1

No, haven’t tried this template yet. Will do.

This is actually a bug in the documentation – will be fixed in an upcoming release. (It’s a goal of ours to remove the need to make the switch, but the docs happened before the actual code was finished!)

For now, just like on iOS, you need to select the Device or Simulator SDK in Player Settings. Note that if you do a device build and manually switch the xcode project to allow targeting the simulator, you may get strange crashes – the Unity code that’s linked in is different between the two, because the simulator and device have different Metal characteristics.

2 Likes

Ah, that explains it :slight_smile: