Challenges with Integrating Cesium for WebGL: Seeking Solutions

So I tried setting up source codes for Cesium Native so as to build it in Unity for WebGL, but this did not work out. It appears that the issue is Unity-related as well as the way they generated source code for their native library. Unity does not have any interface to separate/mark C/C++ source files for multiple plugins, therefore it basically imports all headers in single folder when trying to compile using emscripten.

This cannot work with Cesium native code because they have named many header files exactly same in various folders. Also, third party sources that Cesium native depends upon also have many headers with same names. This means that separate libraries have to be compiled from their source code as well as for third party dependencies using emscripten and then add compiled libraries to our Unity project.

It will still require quite some time to setup all the library projects and then first compile third-party dependencies and, later, the actual Cesium native sources in WASM libraries so that they can than be used as native plugins for WebGL in our app.

Has anyone faced a similar issue? Curious how we could resolve this in a simpler and more time-efficient manner.

We haven’t tried compiling our native code to WASM, and we expect there will be some challenges. We’re interested to hear how you go, though!

1 Like