Fatal error while spawning Cesium3DTileset

Hi I’m switching from CesiumForUnreal version 2.1.0 to version 2.7.1, and I am encountering a fatal error in packaged executable. In my current user workflow, I have a custom C++ actor that spawns a Cesium3DTileset during BeginPlay() and then sets the ion access token at runtime via C++. When I switched to version 2.7.1 , I started seeing a fatal crash in packaged game that happens at the below line in Cesium3DTileset. I do not use a default access token in my project and my token value is set at runtime right after the call to spawning the Cesium3DTileset actor. I would like to know if I need to update my code related to spawning tileset in 2.7.1 version update.

Here’s my code to spawn the tileset.

WorldTerrain = GetWorld()->SpawnActor<ACesium3DTileset>(FVector::ZeroVector,FRotator::ZeroRotator);
WorldTerrain->SetIonAssetID(1);
WorldTerrain->SetIonAccessToken(GeoSpatialConfig.AccessToken);
GeoRef = WorldTerrain->ResolveGeoreference();

Here’s the error I’m getting

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000080
0x00007ff64b3086d7 AutoVrtlEnv.exe!FString::FString() []
0x00007ff65449a0a5 AutoVrtlEnv.exe!ACesium3DTileset::LoadTileset() [C:\TEMP\Bsim3d_2709503_12248\AutoVrtlEnv\Plugins\CesiumForUnreal\Source\CesiumRuntime\Private\Cesium3DTileset.cpp:1196]
0x00007ff65449a884 AutoVrtlEnv.exe!ACesium3DTileset::OnConstruction() [C:\TEMP\Bsim3d_2709503_12248\AutoVrtlEnv\Plugins\CesiumForUnreal\Source\CesiumRuntime\Private\Cesium3DTileset.cpp:660]
0x00007ff65080633c AutoVrtlEnv.exe!AActor::ExecuteConstruction() []
0x00007ff650791429 AutoVrtlEnv.exe!AActor::FinishSpawning() []
0x00007ff6507a8219 AutoVrtlEnv.exe!AActor::PostSpawnInitialize() []
0x00007ff651388bc7 AutoVrtlEnv.exe!UWorld::SpawnActor() []
0x00007ff65138904e AutoVrtlEnv.exe!UWorld::SpawnActor() []
0x00007ff654c3487b AutoVrtlEnv.exe!UWorld::SpawnActor<ACesium3DTileset>() [C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\Engine\Classes\Engine\World.h:3463]

Thank you,
Harshal Mehta

Update:
It appears that based on the change logs of version 2.2.0, the CesiumIonServer uses the CesiumIonSaas data asset that is not getting packaged in my game because I spawn the tileset at runtime via C++ and there are no references to CesiumIonSaas data asset in my project. After forcing that data asset to be packaged in the game, the fatal error disappears. Is this the right solution for this problem? Can I avoid the fatal error coming from accessing uninitialized FString (this->CesiumIonServer->DefaultIonAccessToken) without packaging that data asset?

Thanks,
Harshal

Yes, that’s the right solution. Good find!

I don’t think there’s any other solution short of changes to the Cesium for Unreal soure code. Even if we added a null check there, there are likely other places that will assume a valid CesiumIonServer, and in the end we need a valid ion API end point URL in order to load an asset from there. So perhaps the plugin should force CesiumIonServer instances to always be included in built games, so you don’t have to do that manually?

1 Like

Thanks for confirming! Yes it would be great if all dependencies like that could either be automatically forced to be built in games or at the least throw an error suggesting which dependency is missing in game rather than an access violation error.

I noticed that UCesiumIonServer::GetDefaultServer() can create the data asset required while using the editor, but in my case since our workflow is to spawn a tileset in built game at runtime, this gives nullptr. So there’s no good way for my packaging script to automatically find this dependency and package it for use in built game.

I wrote an issue for us to address this:

1 Like