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