CesiumGS / cesium-unity

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

Android one wont run - Error Unity DllNotFoundException: CesiumForUnityNative #442

Open amigax opened 6 months ago

amigax commented 6 months ago

2024/03/21 20:37:44.121 27203 27307 Error Unity DllNotFoundException: CesiumForUnityNative-Runtime assembly: type: member:(null)

Weirdly I built it fine few days ago but when I try now I get this error. ideas?

kring commented 6 months ago

Please provide more context. What version of Unity and Cesium for Unity are you using? When does this error occur? Does it also happen in the Cesium for Unity Samples project, or only in your own project? What process architecture are you building for? Keep in mind that Cesium for Unity supports 64-bit processors only: ARM64 and x86-64. Building for ARMv7 won't work.

amigax commented 6 months ago

I think the majority of the issue is the way supply Cesium. Since you supply it so awkwardly (not a package) people have to hack it into their project (ie, copy the assets/ folder from your sample project copy it into their proj and pray, then wait for errors and fix). It somehow worked fine when I first tried your sample proj (ie no hacking, even with ARMV7 worked all was fine, though there is NO way to untick arm7 and tick the others, boxes greyed out - still worked, does not 2 days later), but that too has the exact same issues a few days later (dont ask me how). Unity 2022.2.21, error occurs when u build it and get it going on android, you see it in logcat. Also cesium has been crashing unity 8 or 9x a day with a segfault even when im not using it (webgl/android platforms both crash), which has made unity very unstable. So a few mysteries, 1) why dont you ship it as a package? 2) why does it work then die over time, 3) why cant the arm checkboxes be ticked, 4) why does it segfault unity even when not in use?

kring commented 6 months ago

@amigax we do supply it as a package. Have you seen the Quickstart? https://cesium.com/learn/unity/unity-quickstart/

Cesium for Unity will definitely not work on ARMv7. The Samples project, however, is already configured to use ARM64, so you wouldn't have had to change anything to get that to work.

As for not being able to untick ARMv7 and tick ARM64 in your own project, that's probably because Unity is configured in your project to use Mono, which only supports ARMv7. Switch to il2cpp and you'll be able to use the other platforms.

WebGL is not supported, and probably crashes when attempting to load the (non-existent) native code. The same will be true on Android if you're trying to use ARMv7.

amigax commented 6 months ago

Oh, sorry I forgot about the quickstar.t. I think it looked too much work so I tried to just use the sample assets. I guess I will start again and use that, seems like a lot of work to get started. I was unable to switch to il2cpp, but I think you need to install that separately somehow if I remember rightly. thanks will have another go.