Cesium Unity on Apple Vision Pro

I’ve tried building the Cesium Unity SDK for Vision Pro. Everything works with Polyspatial in Editor, although I get a bunch of ‘Reinterop’ errors. I had something similar with the ESRI Maps SDK, and they gave me a few lines to add into the ‘Interior.cs’ file (see here). That didn’t fully solve the issue, but at least allowed the project to fully build from the Unity side of things. Does anybody know a possible fix for this?

I don’t know much about the Vision Pro, but based on Esri’s response, it sounds like the native code for VisionOS might be identical to the iOS code. If that’s the case, we just need to make Cesium for Unity use it. However, the fact that it didn’t actually work for the user in the end implies there might be more to it than that.

In any case, if you want to give it a try, you’ll need to make the same change in a whole bunch of scripts. In the Cesium for Unity package, open every file in Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator and replace all occurrences of #if !UNITY_EDITOR && UNITY_IOS with #if !UNITY_EDITOR && (UNITY_IOS || UNITY_VISIONOS).

I honestly have no idea if that will work, but it’s worth a try! Let us know.

1 Like

Thanks for the try, although it keeps doing that thing where every time I save and switch back to Unity it returns it to the original code.

Hmm yeah Unity does that. Perhaps if you double-click the script from within the Editor itself and edit it that way? If that doesn’t work, you’ll likely need to move the package into your project rather than installing it via the Unity package manager. You can download releases here:

Create a directory in your project called Packages and a subdirectory within there called com.cesium.unity. Then extract the contents of the package directory inside the release tgz file into that directory. When you get done, if you put it in the right place, this file should exist:

[Project Directory]/Packages/com.cesium.unity/package.json

I followed what you said and replaced all UNITY_IOS with (UNITY_IOS || UNITY_VISIONOS). The project no longer reports errors, but cannot be run after packaging, prompting that something is missing.

Thanks for the useful information.
I am also trying to display a 3D map in VisionPro using Cesium for Unity.
I added !UNITY_EDITOR && (UNITY_IOS || UNITY_VISIONOS) and it builds successfully in Xcode.
However, as soon as the app launches, it crashes.
It seems to be an error in the reinterpret_cast of the ReinteropInitializer_initializeReinterop method.
If you know the cause of this problem, please let me know.
I’m sorry for asking this question while it is not yet supported to VisionPro.


Please make the Cesium for Unity official Release for Vision OS as soon as possible lots people are looking forward for it

1 Like