Editor crash issue with cesium for unity package 1.15.4

editor crash issue with cesium for unity package 1.15.4

Hi I found editor crash issue with cesium for unity package 1.15.4

is there any hotfix or workaround of this? if anyone knows please share with me :slight_smile:

environment
1.windows 10 64bit
2.unity editor 2022.3.29f1

reproduction step

  1. git clone cesium for unity samples v1.15.3
  2. download cesium for unity package 1.15.4 ( com.cesium.unity-1.15.4.tgz ) on github (GitHub - CesiumGS/cesium-unity: Bringing the 3D geospatial ecosystem to Unity)
  3. unzip to unity package files to following path cesium-unity-samples/Packages/com.cesium.unity
  4. open the cesium for unity samples project with unity editor 2022.3.29f1
  5. open scene 02_CesiumMelbourne.unity
  6. click play button and stop button again again until crash issue occurs (from my exprience this occurs in within 10 times trying repeat)

I am attaching the editor log file
Editor log.zip (669.1 KB)

I found that this issue doesn’t occur with com.cesium.unity-1.14.1.tgz

from com.cesium.unity-1.15.0.tgz and later versions this issue occurs.

FYI.

@Tom_Lee Thank you for the bug report! I’ve been able to reproduce this issue and I believe I’ve tracked down the cause. I created a pull request on GitHub to get a fix in to prevent this crash.

Thank you for the fast follow up!

I checked yours PR and I merged the PR branch into main branch and I built it on my computer.

unfortunately this problem is still remain.

I attached the editor log here
Editor-20250324.zip (648.8 KB)

@Tom_Lee I don’t notice a crash listed in the editor log you sent. Did you experience a crash that for some reason wasn’t included in the log, or are you referring to the error messages logged?

I am not sure this logs are pointing at root cause. but check these please. these are from Editor-20250324.zip I attached here few days ago.


[2025-03-24 13:33:44.459] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.460] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.461] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.461] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.462] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.462] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.462] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.463] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.463] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.464] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.464] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.465] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.465] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.466] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

[2025-03-24 13:33:44.466] [error] [TilesetContentManager.cpp:1130] An unexpected error occurred when loading tile: Specified cast is not valid.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr,intptr*) (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:22627)
CesiumForUnity.Cesium3DTileset:Update () (at ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/Cesium3DTileset-generated.cs:125)

(Filename: ./Packages/com.cesium.unity/Runtime/generated/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs Line: 22627)

@azrogers
I tested yours PR branch code. there is no issue of this.

I found that yours PR branch is behind latest main branch, omitting latest commits.

please make sure merge yours PR branch to main branch on local repository, and build it.

you can reproduce this issue again. still remain.

as I mentioned before 1.14.1 version seems fine. I think the PR branch based on v1.14.1 please check that.

You’re right, I’ve confirmed there’s still crash issues in the latest version of main even with this fix. Unfortunately, it’s not an issue that’s simply fixed by rolling back to an older version (as demonstrated by my being able to reproduce this crash testing it out on an older version!). It’s fundamentally an issue of a race condition, where actions that we’re performing in another thread are happening while objects are getting cleaned up by Unity on the main thread. If the code on our thread happens to run before Unity cleans things up, we’re good. If it happens to run during or after Unity cleans things up, we crash. The order that things happen on these two threads isn’t deterministic, and can be affected by any number of issues: using different CPUs, different compiler versions, different versions of Unity, other programs running on the system, even the temperature that your computer is running at.

Unfortunately, I don’t have a simple fix for this issue, but I’ve created an issue on GitHub to track it so we can be reminded of it.

1 Like

@azrogers
thank you for quick following up!

I am not sure this editor crash issue affect built application. I wonder what your opinion is

@Tom_Lee The crash happens on AppDomain reload, which is to say it happens when Unity resets the scripting environment. I believe, based on Unity’s documentation here, that this is something that only happens in the editor, either when switching from Edit mode to Play mode or when scripts are changed. So it shouldn’t affect built applications, yes.

1 Like

Thanks for your thoughtful opinion. it’s just annoying thing to have crashes while working with the unity editor, but it’s another thing to have problems with the built application, so I was curious to hear from someone who understands this issue better. Thanks again :slight_smile: