Packaging UE Projects with Cesium

I am exploring Cesium for the first time within Unreal Engine and am running into some issues around testing builds. Everything works just fine in editor, specifically when using “Selected viewport”, but crashes when launching as “Standalone game”. It looks like something in the plugin is trying to access the viewport as if it were the editor and not a standalone game. Is this a known issue that can be resolved? Below is a log snippet:

Assertion failed: ModuleManager.IsModuleLoaded(ModuleName) [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Modules/ModuleManager.h] [Line: 277] Tried to get module interface for unloaded module: 'LevelEditor'

UE4Editor_Core!AssertFailedImplV() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:104]
UE4Editor_Core!FDebug::CheckVerifyFailedImpl() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:461]
UE4Editor_UnrealEd!DispatchCheckVerify<void,<lambda_43605246a037fefe24219742e67009f1> >() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:164]
UE4Editor_UnrealEd!UEditorEngine::GetActiveViewport() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1825]
UE4Editor_CesiumRuntime!ACesium3DTileset::GetEditorCamera() [D:\Build\++Portal\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\CesiumForUnreal\Source\CesiumRuntime\Private\Cesium3DTileset.cpp:790]
UE4Editor_CesiumRuntime!ACesium3DTileset::Tick() [D:\Build\++Portal\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\CesiumForUnreal\Source\CesiumRuntime\Private\Cesium3DTileset.cpp:859]
UE4Editor_Engine!AActor::TickActor() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:1093]
UE4Editor_Engine!FActorTickFunction::ExecuteTick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:173]
UE4Editor_Engine!FTickFunctionTask::DoTask() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:284]
UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:886]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:709]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:601]
UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1525]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:564]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1578]
UE4Editor_Engine!UWorld::RunTickGroup() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:782]
UE4Editor_Engine!UWorld::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1576]
UE4Editor_Engine!UGameEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1794]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4836]
UE4Editor!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

If I actually package the project I can avoid this crash as “with_editor” is false, however, it doesn’t seem like any terrain is loading either. Nothing suspect is in the log, and it may just be user error. Are there any special steps required to package projects with Cesium?

Hi @Nagoshi,
The only time Cesium for Unreal should try to obtain the editor camera like that is when a) you’re in a WITH_EDITOR build, and b) ACesium3DTileset::GetPlayerCamera is unable to find a camera. The latter can happen if there’s no UWorld (unlikely), if the world doesn’t have a “First Player Controller”, the player controller doesn’t have a camera manager, or if the world doesn’t have a “game viewport”. Do any of those conditions ring a bell for you? You can find the code implementing this logic here in case it helps:

If not, can you explain in more detail how you’re building and running the standalone game so that we can try to reproduce the issue ourselves?

Thanks,
Kevin

Hi @Kevin_Ring,

Thanks for taking a look! I’ve done a bit more troubleshooting and had better luck in a new, empty UE project. So I suspect there is something about my project that doesn’t quite agree with with Cesium, and I have a pretty good idea of what it could be thanks to your post. I’m going to go ahead and post my rambling thoughts in case they can help anyone else, and if you have any suggestions I’m happy to hear them!

There are two methods I use to run a standalone game without packaging:

  • Run from within UE by clicking the drop-down arrow by the “Play” button and setting the mode to “Standalone Game”.
  • Run the .exe in the project directory: [ProjectDirectory]\Binaries\Win64[ProjectName].exe

In both cases, WITH_EDITOR register as true and I recieve the error in my original post. The problem area seems to be the call to GetEditorCamera() (specifically “FViewport* pViewport = GEditor->GetActiveViewport();”). My guess is this is because there is no LevelEditorModule since the editor isn’t actually running (which makes me wonder why WITH_EDITOR is true but that sounds like an Epic Games question! c: )

There is a UWorld, Player Controller, and Camera Manager, the latter two are custom classes that extend from APlayerController and APlayerCameraManager respectively. The custom classes do have a camera switching feature which has me wondering: as one camera is deactivated and another camera is activated through the Camera Manager, could that potentially cause problems?