After updating from 1.15.3 to 1.23.0, I encountered a new issue: when multiple scenes are present in the hierarchy, entering play mode triggers unexpected errors that prevent Cesium from loading.
Even if all additional scenes are unloaded (leaving only the entry-point scene active), their mere presence in the hierarchy appears to cause the problem.
Once this state occurs, the temporary workaround is to remove all scenes except the entry-point one and restart Unity, which is disruptive to our workflow.
Please let me know if you’d like me to open a GitHub issue as well.
ArgumentException: The scene is not loaded.
Reinterop.ReinteropInitializer+AssemblyReloadCallbackNativeFunction.Invoke () (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:30467)
UnityEditor.AssemblyReloadEvents.OnBeforeAssemblyReload () (at <0e08e1d2ec124b208901fdb811cdf9c2>:0)
Exception while loading Cesium ion app data: Request was canceled because the Unity AppDomain is reloading.
UnityEngine.Debug:LogError (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLogError_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:32766)
CesiumForUnity.CesiumIonSession:Tick () (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/generated/Reinterop.RoslynSourceGenerator/CesiumIonSession-generated.cs:295)
CesiumForUnity.CesiumEditorUtility:UpdateIonSession () (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/Editor/CesiumEditorUtility.cs:27)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
Exception while resuming Cesium ion connection: Failed to obtain _appData, can’t resume connection
UnityEngine.Debug:LogError (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLogError_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:32766)
CesiumForUnity.CesiumIonSession:Tick () (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/generated/Reinterop.RoslynSourceGenerator/CesiumIonSession-generated.cs:295)
CesiumForUnity.CesiumEditorUtility:UpdateIonSession () (at ./Library/PackageCache/com.cesium.unity@04d259c6404d/Source/Editor/CesiumEditorUtility.cs:27)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
Thank you for the detailed report — the stack trace is really helpful here.
Just to confirm my understanding: after upgrading to 1.23.0, having any additional scenes present in the Build Settings hierarchy (even fully unloaded ones) causes errors when entering play mode, and the only workaround is to physically remove those scenes and restart Unity. Is that right?
The stack trace points to an assembly reload callback in Reinterop (OnBeforeAssemblyReload) that appears to be iterating over scenes and hitting one that isn’t loaded:
ArgumentException: The scene is not loaded.
ReinteropInitializer+AssemblyReloadCallbackNativeFunction.Invoke()
This then causes CesiumIonSession to lose its app data and fail to resume the ion connection. The root cause looks like a scope issue in how the assembly reload callback handles unloaded scenes — this appears to be a regression introduced somewhere between 1.15.3 and 1.23.0.
A couple of questions to help us narrow it down:
Which version of Unity are you using?
Can you reproduce this with a minimal project (two empty scenes in Build Settings, Cesium in only the first)?
Do you know if this started in a specific intermediate version (e.g., does 1.16.0 work)?
I’d like to open a GitHub issue to track this — it looks like something the engineering team should investigate. Happy to do that once we confirm the reproduction steps.
I’m working on updating Cesium from 1.8 and I believe I’ve run into this issue, both in Unity 2022.3.62f2 and in 6.6. Here’s a writeup from Codex, which I hope will help.
I can reproduce this with the official Cesium for Unity 1.25.1 package on Unity 2022.3.62f2 (Windows). Cesium ion connects in Edit Mode, but entering Editor Play Mode with an unloaded scene in the Hierarchy throws:
ArgumentException: The scene is not loaded.
Reinterop.ReinteropInitializer+AssemblyReloadCallbackNativeFunction.Invoke () (at ./Library/PackageCache/com.cesium.unity@1.25.1/Source/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:263544)
UnityEditor.AssemblyReloadEvents.OnBeforeAssemblyReload () (at <4b8f645257c94d1296f440a10c6f388e>:0)
Exception while loading Cesium ion app data: Request was canceled because the Unity AppDomain is reloading.
UnityEngine.Debug:LogError (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLogError_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Library/PackageCache/com.cesium.unity@1.25.1/Source/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:265516)
CesiumForUnity.CesiumIonSession:Tick () (at ./Library/PackageCache/com.cesium.unity@1.25.1/Source/generated/Reinterop.RoslynSourceGenerator/CesiumIonSession-generated.cs:1095)
CesiumForUnity.CesiumEditorUtility:UpdateIonSession () (at ./Library/PackageCache/com.cesium.unity@1.25.1/Source/Editor/CesiumEditorUtility.cs:27)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
This also affects tile loading. My active tileset uses a direct Google 3D Tiles URL. In Play Mode, TilesetContentManager reports Request was canceled because the Unity AppDomain is reloading, and ComputeLoadProgress() remains at 0%. A later tile request reports the same cancellation without another assembly reload.
The likely cause is in shutdownExternals() in v1.25.1. It calls failAllFutureRequests() and cancelActiveRequests(), then calls GetRootGameObjects() for every scene without checking isLoaded. The unloaded scene throws before pWebRequestAccessor.reset() runs. The request accessor then continues rejecting future requests.
Could the scene loop skip unloaded scenes and ensure accessor cleanup completes if scene inspection throws? I couldn’t find a GitHub issue for this specific case; #630 appears related but covers broader AppDomain reload work.