Unreal使用GooglePAD生成AAB包,并加在fast-follow资源
1.修改obbfilter,设置需要添加到obb的pak文件
2.修改项目设置,打AAB包
3.cook stage生成所有Paks文件
4.将部分pak文件拷贝到Intermediate/Android/arm64/gradle/assetpacks/fast-follow/包名/src/main/assets文件夹下,GooglePad插件的XML会自动将ast-follow/XXXX文件夹识别为fast-follow包,install-time不需要设置,默认会把obb打进去
5.打包完成后,安装AAB文件,使用GooglePad api读取Fast-follow资源
点击查看代码
int32 GetStatus(EGooglePADDownloadStatus& InDownResult)
{
int32 TmpDownloadStatus = -1;
EGooglePADErrorCode res3 = UGooglePADFunctionLibrary::GetDownloadState("SecPaks", TmpDownloadStatus);
InDownResult = UGooglePADFunctionLibrary::GetDownloadStatus(TmpDownloadStatus);
UE_LOG(GoogleAAB, Log, TEXT("chenghh download status: %d"), static_cast<int32>(InDownResult));
return TmpDownloadStatus;
}
void UHotUpdateManager::StartAssetDownload()
{
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
EGooglePADErrorCode res1 = UGooglePADFunctionLibrary::RequestInfo({"SecPaks"});
UE_LOG(GoogleAAB, Log, TEXT("RequestInfo result: %d"), static_cast<int32>(res1));
EGooglePADErrorCode res2 = UGooglePADFunctionLibrary::RequestDownload({"SecPaks"});
UE_LOG(GoogleAAB, Log, TEXT("RequestDownload result: %d"), static_cast<int32>(res2));
EGooglePADDownloadStatus GetStatusRes = EGooglePADDownloadStatus::AssetPack_UNKNOWN;
int32 StateId = GetStatus(GetStatusRes);
while (GetStatusRes != EGooglePADDownloadStatus::AssetPack_DOWNLOAD_COMPLETED)
{
UGooglePADFunctionLibrary::ReleaseDownloadState(StateId);
StateId = GetStatus(GetStatusRes);
}
int32 Location = -1;
EGooglePADErrorCode Code = UGooglePADFunctionLibrary::GetAssetPackLocation("SecPaks", Location);
UE_LOG(GoogleAAB, Log, TEXT("Asset pack location: %d"), Location);
FString AssetPath = UGooglePADFunctionLibrary::GetAssetsPath(Location);
if (!AssetPath.IsEmpty())
{
PlatformFile.DirectoryExists(*AssetPath);
UE_LOG(GoogleAAB, Log, TEXT("Asset pack Path: %s"), *AssetPath);
FString PakAssetPath = AssetPath + "/Paks";
if (PlatformFile.DirectoryExists(*PakAssetPath))
{
PlatformFile.FindFiles(AssetNames, *PakAssetPath, TEXT(".pak"));
........
}
}
UGooglePADFunctionLibrary::ReleaseAssetPackLocation(Location);
UGooglePADFunctionLibrary::ReleaseDownloadState(StateId);
}

浙公网安备 33010602011771号