Pak file not loading automatically at launch

Hello,

I followed this tutorial on 4.9 → A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

and worked very well, now I’m trying to do the same with my current project in 4.12.5 and I can’t load the map contained in the pak file.

No errors, everything packages and compile fine, it’s just like the pak file is not automaticlly loaded like it’s stated in the tutorial. I also tried to replicate the tutorial in 14.3 an 15.0 p3, and ran in a handful more problems, always leading to the final result of not being able to load the pak. But it works fine in 4.9!

I also tried to use the Onmountpak.execute to load the pak files manually, also tried with absolute URLs,also at the game root or content root, nothing worked so far.

Any ideas, even the smallest information would be overwhelmingly appreciated!

Thanks for reading!!

PS: Also tried with blank template projects, and migrated version of the tutorial one in all the engine versions stated above.

OK, apparently it doesn’t load paks automatically, I managed to load my pak at runtime, and list it’s content with this: (Very Ugly code, don’t use it as is, it logs everything and shows screen messages, works in 4.12.5)

// Load Pak
void AFireStarterGameMode::LoadPakFile(FString Path)
{
	if (FCoreDelegates::OnMountPak.IsBound()) {
		FCoreDelegates::OnMountPak.Execute(Path, 3, nullptr); //Number should be 0-4; specifies search order
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Pak should be loaded"));
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Is not Bound"));
	}

	IPlatformFile& InnerPlatformFile = FPlatformFileManager::Get().GetPlatformFile();

	FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
	PakPlatformFile->Initialize(&InnerPlatformFile, TEXT(""));

	//PakPlatformFile->Mount(*PakToLoad, 0, *(Path)); // Not Original

	TArray<FPakPlatformFile::FPakListEntry> MountedPaks;
	PakPlatformFile->GetMountedPaks(MountedPaks);

	UE_LOG(LogTemp, Warning, TEXT("Befroe Scan Loop"));
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Before Scan Loop"));
	//ignore first pak, because it is default game pak and we don't need iterate over it
	for (int32 i = 0; i < MountedPaks.Num(); i++)
	{
		UE_LOG(LogTemp, Warning, TEXT("OnePack"));
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("OnePack"));
		const FPakPlatformFile::FPakListEntry& mountedPak = MountedPaks[i];
		const TMap<FString, FPakDirectory>& pakDirectoryMap = mountedPak.PakFile->GetIndex();

		for (TMap<FString, FPakDirectory>::TConstIterator It(pakDirectoryMap); It; ++It)
		{
			FString Key = It.Key();
			const FPakDirectory& Val = It.Value();

			for (FPakDirectory::TConstIterator It2(Val); It2; ++It2)
			{
				FString Key2 = It2.Key();
				FPakEntry* pakEntry = It2.Value();

				//if (Key2.Contains(TEXT(".umap")))
				//{
					UE_LOG(LogTemp, Warning, TEXT("OneFile"));
					GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("OneFile"));
					//this is where you will get map name of course if your map have *.umap extension:)
					Key2 = Key2;
					UE_LOG(LogTemp, Warning, TEXT("File: %s"),*Key2);
					GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red,TEXT("File: " + Key2));
				//}
			}
		}
	}
}

this code needs some engine modifications to make FPakListEntry public