Imagery not loading in Cesium for Unity in Android

Hello, I have created a simple 2D Unity scene in which I am viewing the ground from vertically above, making the 3D tileset look like a 2D map. I am using Cesium World Terrain and Bing maps imagery. It works fine on my PC, but when I run the .apk on an Android tablet, the imagery does not load at all - there is just a gray screen in place of the map. I got several warnings after building the apk, here are some of them:

Shader warning in ‘Cesium/CesiumDefaultTilesetShader’: implicit truncation of vector type at Files/2022.3.16f1/Editor/Data/CGIncludes/UnityShadowLibrary.cginc(60) (on gles3)

Compiling Subshader: 1, Pass: BuiltIn ForwardAdd, Vertex program with SHADOWS_DEPTH SHADOWS_SOFT SPOT _ADDITIONAL_LIGHTS _MAIN_LIGHT_SHADOWS_CASCADE
Platform defines: SHADER_API_GLES30 SHADER_API_MOBILE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_LIGHTMAP_RGBM_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_FORWARDADD UNITY_PBS_USE_BRDF3
Disabled keywords: DIRECTIONAL DIRECTIONAL_COOKIE DIRLIGHTMAP_COMBINED FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING POINT POINT_COOKIE SHADOWS_CUBE SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF2 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHT_SHADOWS _ADDITIONAL_OFF _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_SCREEN _SCREEN_SPACE_OCCLUSION _SHADOWS_SOFT

There were a total of 16 of this kind of shader warnings. Also,

Plugin ‘Packages/com.cesium.unity/Plugins/iOS/lib/libCesiumJsonReader.a’ doesn’t have CPU architecture set, since it’s a native plugin, valid architecture is required, skipping.
System.Linq.Enumerable/WhereEnumerableIterator1<object>:MoveNext () Bee.BeeDriver.BeeDriver:WriteDataForBuildProgram (Bee.BeeDriver.InternalState,System.Threading.Tasks.TaskCompletionSource1)
Bee.BeeDriver.BeeDriver/<>c__DisplayClass0_0:g__WriteData|0 ()
Bee.BeeDriver.BeeDriver:BuildAsync (Bee.BeeDriver.BuildRequest,System.Threading.CancellationToken)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

There were 28 of these “doesn’t have CPU architecture set” warnings. I don’t know what this means. Any help is appreciated

Update:

So I’ve realized that the reason for the issue might be related to the fact that I am having to specify the Cesium Ion access token every time I open the project in Unity. On launch, the following message pops up:


I am having to set the default access token every single time I open the project. Is there a way I can prevent this?

Hi @Magmathrower8,

The ion token is usually stored in Assets/CesiumSettings/Resources/CesiumIonServers/ion.cesium.com.asset. It should be saved automatically when you modify it using the “Token” panel. As a guess: perhaps that file is under source control on your system by something like Perforce that stores files read-only, and so the save is failing?

@Magmathrower8, I just confirmed this is indeed a bug. More information (and a workaround) here:

1 Like

Hi, thanks for the reply. I managed to fix the token issue using this workaround. But this didn’t actually fix the initial problem I was facing.

The .apk build still does not load Cesium imagery. All I see in place of the imagery is a gray screen. I am getting a message on the android device that “this app is not compatible with the current version of android”, but I don’t think that matters because the other elements I created using the Unity editor are working fine.

I tried creating a windows build for the same Unity project, and the imagery loads correctly in it. Please let me know if there is any more information I can provide, and thank you for the help so far.

Hi @Magmathrower8, my best guess is that your project is targetting ARMv7, which is a 32-bit platform and therefore is not compatible with Cesium fro Unity. See here (and note the message a bit further down noting that you must enable IL2CPP; Unity does not support Mono on 64-bit ARM):

If that’s not the problem, please check if the Cesium for Unity Samples project deploys and works on your device.

Thank you, this actually was the issue! Much appreciated.

1 Like