CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
356 stars 85 forks source link

Vision Pro Reinterop build issue #409

Open mechpil0t opened 8 months ago

mechpil0t commented 8 months ago

When building for Vision Pro (visionOS - both device and simulator SDK) you get a Reinterop not found error.

I assume because the Reinterop has not been compiled for visionOS?

kring commented 8 months ago

I assume because the Reinterop has not been compiled for visionOS?

Reinterop itself is .NET code and doesn't need to be compiled for any particular platform. However, the Cesium for Unity native code has not been compiled for the Vision Pro. You may be able to get it to work by building manually from the source in this repo (not the source that is included in the shipped package; it doesn't have all the bits that are needed to compile the native code). See the developer setup instructions, though you definitely won't be able to just follow them blindly. This thread on the community forum discusses the possibility of using the iOS build of the native code on Vision Pro, too, though I have no idea if that will work.

GiantSox commented 7 months ago

I'm getting closer after building the CMake project (with a few modifications) and copying the files into the Unity-generated Xcode project... but running into one last linker error. Any hints as to which library I might be missing? :)

Screenshot 2024-03-13 at 9 35 51 AM
csciguy8 commented 7 months ago

That's a cesium native function.

Is \CesiumIonClient\src\Connection.cpp getting compiled in addition to the other cesium-native source files?

GiantSox commented 7 months ago

@csciguy8 As far as I can tell, yes (the build fails if I put uncompilable code in Connection.cpp). CesiumIonClient isn't supposed to be built as its own library is it?

edit: seems like a libCesiumIonClient.a is being built, but is not currently set to be installed to the Unity folder along with the other libraries. I'll check if adding that fixes things

kring commented 7 months ago

Not much context in that error screenshot, but the interesting thing about CesiumIonClient is that the CesiumRuntime assembly doesn't use it; only CesiumEditor does. So it's possible you're copying files into one but not the other? Just a guess.

GiantSox commented 7 months ago

@kring The error was in Xcode when linking the project, not in Unity. Though I also don't fully understand how Reinterop works. Still not sure what I'm doing wrong. Sadly adding libCesiumIonClient.a didn't fix it :(

jaiyramanan23 commented 7 months ago

I assume because the Reinterop has not been compiled for visionOS?

Reinterop itself is .NET code and doesn't need to be compiled for any particular platform. However, the Cesium for Unity native code has not been compiled for the Vision Pro. You may be able to get it to work by building manually from the source in this repo (not the source that is included in the shipped package; it doesn't have all the bits that are needed to compile the native code). See the developer setup instructions, though you definitely won't be able to just follow them blindly. This thread on the community forum discusses the possibility of using the iOS build of the native code on Vision Pro, too, though I have no idea if that will work.

I according to that I added package manually as well and tried adding all the codes to in Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator to#if !UNITY_EDITOR && (UNITY_IOS || UNITY_VISIONOS) but still the error exists. Please release an official Cesium for unity support for Vision OS lots of people are requesting.

Screenshot 2024-03-29 at 13 41 54
lionelgitman commented 2 months ago

I solved the reintrop errors those received from cesium when building for vision pro reach me out at ht056883@gmail.com to get the issues resolved cesium package

shahmeer1124 commented 2 months ago

Hi everyone, the reintrop and other package-specific issues have been resolved, and the project is now building successfully. However, I'm facing an issue where Google Earth is visible in the Unity Editor, but it doesn't appear when I run the project on the Vision Pro emulator. If anyone has any insights or can help with this, I'd really appreciate it!

Screenshot 2024-09-02 at 11 33 12 AM Screenshot 2024-09-02 at 11 33 25 AM
kring commented 2 months ago

@shahmeer1124 perhaps if you open a pull request with your work so far, I or someone can take a look and will have some ideas. Otherwise, we don't know what you did, and the best we can do is guess, right?

kring commented 2 months ago

Same to you @lionelgitman: we'd appreciate a pull request.

shahmeer1124 commented 2 months ago

@kring basically i just added this tag #if !UNITY_EDITOR && UNITY_IOS with #if !UNITY_EDITOR && (UNITY_IOS || UNITY_VISIONOS) in all the files present in runtime/generated/Reintrop/Reinterop.RoslynSourceGenerator and issues are solved

shahmeer1124 commented 2 months ago

now i tried one other thing the earth is showing up in the full immersive view but in the background it shows the blue color sky of unity but i need in immersive view then i change the player setting to mixed reality it crashes the app

Screenshot 2024-09-02 at 9 08 30 PM Screenshot 2024-09-02 at 9 16 06 PM

I tried to create the pr but the files that i updated was not present in the repo because i downloaded a folder ending the extension.tgz I don't remeber the full name but i upload the full project you can test this project https://drive.google.com/file/d/1G9nex7wOIVjdlpx_Gnynx7JAE-JVOHlJ/view?usp=sharing after downloading the file please go inside the packages folder there will be a folder com.cesium.unity.zip just unzip that folder and the project will start working

mechpil0t commented 2 months ago

@kring basically i just added this tag #if !UNITY_EDITOR && UNITY_IOS with #if !UNITY_EDITOR && (UNITY_IOS || UNITY_VISIONOS) in all the files present in runtime/generated/Reintrop/Reinterop.RoslynSourceGenerator and issues are solved

This solves the Reinterop error but then I get a load more errors

AVPCesium

tarukosu commented 2 months ago

Hello,

I am releasing a project as open-source software that uses Cesium for Unity in an application running on Vision Pro. The modifications made to Cesium for Unity are documented in the README. Changing the shader is only needed for MR mode. https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity

Also, please attach the following component to the Cesium 3D Tileset for MR mode. https://gist.github.com/tarukosu/b4ef460e4e9616d35e10fc53794a41c3

Additionally, the library error during the Xcode build can be resolved using the following build script. https://github.com/HoloLabInc/ProjectSpirare-for-Unity/blob/main/unity/SpirareBrowser-visionOS-3DMaps/Assets/App/Editor/CesiumPostProcessBuildForVisionOS.cs

I hope this information is helpful.

shahmeer1124 commented 2 months ago

@tarukosu I followed all the steps from this https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity even though i doesn't got any error but still map is not visible

Screenshot 2024-09-03 at 2 08 09 PM