Streaming Level loaded from a Pak File

Hi all, I have some questions and problems when streaming a level loaded from a pak file. What I basically wan’t to achieve is that another developer can create a pak file with any level in it and my game can load and unload this level. I don’t know if this is the best way to achive this but currently I am doing the following:

// Mount pak
PakFileHelper->MountAndRegisterPak(PakFilePath

// List levels in pak
TArray<FString> LevelsInPak = PakFileSubsystem->GetPakLevelContent(PakFilePath);

// Reload asset registry to load assets from pak file
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
AssetRegistryModule.Get().ScanPathsSynchronous({"/Game/"}, true);

// Stream Level
bool bOutSuccess = false;
ULevelStreamingDynamic* LevelStreaming = ULevelStreamingDynamic::LoadLevelInstance(
	GetWorld(),
	LevelsInPak[0],
	FVector::ZeroVector,
	FRotator::ZeroRotator,
	bOutSuccess);

// Check level streamed load status
if (bOutSuccess)
{
	// Load level to scene
	LevelStreaming->SetShouldBeLoaded(true);
	LevelStreaming->SetShouldBeVisible(true);
}

The loading in the editor actually works fine and I can succesfully see the level in the scene. Altough I don’t know why I have to reload the asset registry. Other similar solutions didn’t had to do this, but it doesn’t work without it.
However if I end the simulation or if I unload the streamed level, the whole editor crashes with the following error:

Error        LogWindows                appError called: Assertion failed: LevelStreaming || GetActorCount() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionRuntimeLevelStreamingCell.cpp] [Line: 630] 

I tried looking into the source code but I didn’t quite understand what they are doing there. Also note that this is only the case if I play the game in the editor. If I run a packaged version of the game the unloading works totally fine.

However in the packaged version of the game there is another problem with loading the level. In the editor the loaded level looks totally fine. Here is an example (really basic):


In the packaged game the same loaded pak level looks the following:

So my question mostly is if there is anything I am doing wrong here because some things only work in the editor and some things only work in the packaged game. Also with the crashes in the simulation this is really annoying to test so there has to be a better way of doing this.

Note that there are some other errors logs, which happen without any action while playing the game so I don’t know if it’s related to thisbut I’ll attach a full log just in case:

Full Log of play in editor (Streaming level from pak, then ending the simulation)
Display      LogPakFile                Mounted Pak file 'C:\DEV\TestEnvironments\1\map.pak', mount point: '../../../ArtistPluginDevelop/Content/'
Display      LogPakFile                Mount point '../../../ArtistPluginDevelop/Content/' is not mounted to a valid Root Path yet, assets in this pak file may not be accessible until a corresponding UFS Mount Point is added through FPackageName::RegisterMountPoint.
Log          LogTemp                   Pak Valid: C:\DEV\TestEnvironments\1\map.pak | MountPoint: 
Log          LogPackageName            FPackageName: Mount point added: '../../../ArtistPluginDevelop/Content/' mounted to '/Game/'
Log          LogDirectoryWatcher       A directory notification for 'C:/DEV/Unreal/mrsv-unreal-client/Content/' was aborted.
Log          LogFileCache              Scanning file cache for directory 'C:/Program Files/Epic Games/UE_5.4/ArtistPluginDevelop/Content/' took 0.01s
Display      LogTemp                   Found level /Game/pakTest/Levels/NewMap.NewMap in loaded pak, trying to stream now
Warning      LogLevel                  Failed to find streaming level object associated with '/Game/UEDPIE_0_ClientMainMap'
Display      LogTemp                   Level /Game/pakTest/Levels/NewMap.NewMap successfully stream loaded to scene
Log          LogBlueprintUserMessages  [MRSVClientActor_C_UAID_14F6D8D90EBCC42802_1703645232] State Changed: Ready
Warning      LogLinker                 [AssetLog] Pak: C:\DEV\TestEnvironments\1\map.pak\pakTest\Levels\NewMap.umap: Asset has been saved with empty engine version. The asset will be loaded but may be incompatible.
Warning      LogLinker                 [AssetLog] Pak: C:\DEV\TestEnvironments\1\map.pak\SimpleTestControlsActor.uasset: Asset has been saved with empty engine version. The asset will be loaded but may be incompatible.
Log          LogSourceControl          IssueAsynchronousCommand: UpdateStatus
Log          LogSourceControl          status of 1 items (ShouldUpdateHistory=0, ShouldGetOpenedOnly=0, ShouldUpdateModifiedState=0)
Verbose      LogSourceControl          /Memory/UEDPIE_0_D8W59309066BXMJRIGW23PXNX_InstanceOf_/Game/__ExternalActors__/ClientMainMap/A/RC/SKQ3FCB5AJDRG01JA97K0Z is out of the Workspace
Verbose      LogSourceControl          RunUpdateStatus: 1 file(s)/0 directory(ies) ('/Memory/UEDPIE_0_D8W59309066BXMJRIGW23PXNX_InstanceOf_/Game/__ExternalActors__/ClientMainMap/A/RC/SKQ3FCB5AJDRG01JA97K0Z'...)
Log          LogSourceControl          UpdateStatus of /Memory/UEDPIE_0_D8W59309066BXMJRIGW23PXNX_InstanceOf_/Game/__ExternalActors__/ClientMainMap/A/RC/SKQ3FCB5AJDRG01JA97K0Z processed in 0.072s
Log          LogWorldPartition         ULevel::OnLevelLoaded(NewMap)(bIsOwningWorldGameWorld=1, bIsOwningWorldPartitioned=1, InitializeForMainWorld=0, InitializeForEditor=0, InitializeForGame=1)
Display      LogWorldPartition         WorldPartition initialize started...
Log          LogWorldPartition         UWorldPartition::Initialize : World = /Game/pakTest/Levels/UEDPIE_0_NewMap_LevelInstance_1.NewMap, World Type = PIE, IsMainWorldPartition = 0, Location = V(0), Rotation = R(0), IsEditor = 0, IsGame = 0, IsPIEWorldTravel = 0, IsCooking = 0
Log          LogWorldPartition         UWorldPartition::Initialize Context : World NetMode = Standalone, IsServer = 0, IsDedicatedServer = 0, IsServerStreamingEnabled = 0, IsServerStreamingOutEnabled = 0, IsUsingMakingVisibleTransaction = 0, IsUsingMakingInvisibleTransaction = 0
Display      LogWorldPartition         WorldPartition initialize took 818 us (total: 6.358 ms)
Log          LogSourceControl          IssueAsynchronousCommand: UpdateStatus
Log          LogSourceControl          status of 1 items (ShouldUpdateHistory=0, ShouldGetOpenedOnly=0, ShouldUpdateModifiedState=0)
Verbose      LogSourceControl          C:/Program Files/Epic Games/UE_5.4/ArtistPluginDevelop/Content/SimpleTestControlsActor.uasset is out of the Workspace
Verbose      LogSourceControl          RunUpdateStatus: 1 file(s)/0 directory(ies) ('C:/Program Files/Epic Games/UE_5.4/ArtistPluginDevelop/Content/SimpleTestControlsActor.uasset'...)
Log          LogSourceControl          UpdateStatus of C:/Program Files/Epic Games/UE_5.4/ArtistPluginDevelop/Content/SimpleTestControlsActor.uasset processed in 0.017s
Warning      LogOutputDevice           Script Stack (0 frames) :
Log          LogStats                  FPlatformStackWalk::StackWalkAndDump -  0.046 s
Error        LogOutputDevice           === Handled ensure: ===
Error        LogOutputDevice           Ensure condition failed: PluginContainingAsset  [File:D:\build\++UE5\Sync\Engine\Source\Developer\AssetTools\Private\AssetViewUtils.cpp] [Line: 1574] 
Error        LogOutputDevice           Only plugins can exist outside of the expected target path of 'C:/DEV/Unreal/mrsv-unreal-client/'. 'C:/Program Files/Epic Games/UE_5.4/ArtistPluginDevelop/Content/MRSVClientActor.uasset' will not calculate an accurate result!
Error        LogOutputDevice           Stack: 
Error        LogOutputDevice           [Callstack] 0x00007ffd437d99fa UnrealEditor-AssetTools.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffd3c2680e1 UnrealEditor-ContentBrowser.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffd3c2a31c6 UnrealEditor-ContentBrowser.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffd511de6de UnrealEditor-Slate.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffd510fa026 UnrealEditor-Slate.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffd510f8ac4 UnrealEditor-Slate.dll!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfb699a1 UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfb8e33c UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfb8e42a UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfb918a4 UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfba70c4 UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ff7cfbaa37a UnrealEditor.exe!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffdef37257d KERNEL32.DLL!UnknownFunction []
Error        LogOutputDevice           [Callstack] 0x00007ffdf140af08 ntdll.dll!UnknownFunction []
Log          LogStats                                 SubmitErrorReport -  0.000 s
Log          LogStats                                     SendNewReport -  1.779 s
Log          LogStats                              FDebug::EnsureFailed -  1.831 s
Log          LogDerivedDataCache       C:/Users/guble/AppData/Local/UnrealEngine/Common/DerivedDataCache: Maintenance finished in +00:00:00.000 and deleted 0 files with total size 0 MiB and 0 empty folders. Scanned 0 files in 1 folders with total size 0 MiB.
Log          LogSlate                  Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
Log          LogWorld                  BeginTearingDown for /Game/UEDPIE_0_ClientMainMap
Warning      LogOutputDevice           Script Stack (0 frames) :
Error        LogWindows                appError called: Assertion failed: LevelStreaming || GetActorCount() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionRuntimeLevelStreamingCell.cpp] [Line: 630] 
Log          LogWindows                Windows GetLastError: The operation completed successfully. (0)

Any help would be grately appreciated!