Hi. I want to make DLC for mobile game.
First step, I made chunk (pak files) and I try to mount them in editor. But I can’t mount them manually. Then I found some information that If I put pak files in Project/Contents/Paks/, They will be automatically mounted. But I can’t use it, I tried to remove content’s assets and I use only pak files. But Project can’t open map and can’t spawn bluerprint. Is it possible mounting mobile pak files in editor? here is code what I found in internet.
Mount manullay
TSharedRef<FPakPlatformFile> DLCPakFile(new FPakPlatformFile());
DLCPakFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT(""));
FString dlc1 = FPaths::ProjectDir() + "Content/DLC/pakchunk0-Android_Multi.upak";
FString pak1 = FPaths::ConvertRelativePathToFull(dlc1);
FString contentsDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectContentDir());
if (DLCPakFile->Mount(*pak1, 1, *contentsDir ))
{
UE_LOG(LogTemp, Error, TEXT("pak0 mount success"));
}
else
{
UE_LOG(LogTemp, Error, TEXT("pak0 mount fails"));
}
Pak files mount automatically from Project/Content/Pak/
FPakPlatformFile* PakPlatformFile;
FString PlatformFileName = FPlatformFileManager::Get().GetPlatformFile().GetName();
if (PlatformFileName.Equals(FString(TEXT("PakFile"))))
{
PakPlatformFile = static_cast<FPakPlatformFile*>(&FPlatformFileManager::Get().GetPlatformFile());
}
else
{
PakPlatformFile = new FPakPlatformFile();
if (!PakPlatformFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT("")))
{
return;
}
FPlatformFileManager::Get().SetPlatformFile(*PakPlatformFile);
}