I made some .pak files using UnrealPak and mounted it in runtime. It compiled and worked as expected in Android. But in windows, engine cannot find most of assets after mounting pak even asset file was not inside in the pak file.
In case the default platform file mana=get is not PakFile, you need to restore it once you are done mounting the pak. This is what my custom UndoSetPakPlatformFile does.
SetPakPlatformFile
mount and do stuff …
UndoSetPakPlatformFile
Everything should be fine now.
IPlatformFile *PreviousPlatformFile = nullptr; // static init
bool CommonFunctionLibrary::SetPakPlatformFile()
{
FPakPlatformFile* PakFileMgr = (FPakPlatformFile*)(FPlatformFileManager::Get().FindPlatformFile(TEXT("PakFile")));
if (PakFileMgr == nullptr)
{
conoutf('I', "PakFile is null. Trying to initialize it ...");
FPakPlatformFile *PlatformFile = new FPakPlatformFile;
if (!PlatformFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT("")))
{
conoutf('E', "FPakPlatformFile failed to initialize");
return false;
}
PlatformFile->InitializeNewAsyncIO();
PreviousPlatformFile = &FPlatformFileManager::Get().GetPlatformFile();
FPlatformFileManager::Get().SetPlatformFile(*PlatformFile);
conoutf('I', "PakFile is fine (just set)");
}
else
{
conoutf('I', "PakFile is fine");
}
return true;
}
void CommonFunctionLibrary::UndoSetPakPlatformFile()
{
// return previous platform file manager to the top of the chain, so Unreal doesn't lose it's references
if (PreviousPlatformFile != NULL)
{
conoutf('I', "PakFile restored");
FPlatformFileManager::Get().SetPlatformFile(*PreviousPlatformFile);
PreviousPlatformFile = nullptr;
}
}
can you please explain how to generate pak files for android and utilize them, have successfully generated and utilized for windows but don’t know how to do this for android mobile