I followed by all setp(link:Stream an asset from the internet - Blueprint - Unreal Engine Forums),
but when I exec my code, the console output these errors:
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1 requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1_ar requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1_no requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1_pmdg requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1material0 requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/adh1_t1material1 requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/NewWidgetBlueprint requested by async loading code.
LogStreaming:Error: Couldn’t find file for package /Engine/s1_ui requested by async loading code.
LogTemp: async load end.
UE4.10 PIE mode
Anybody can tell me what’s wrong?
I guess the pak file did not mount into editor.
Here is my code, it’s a blueprint library function.
void UExternalResBPLib::TestLoadRes(const FString& pakPath, const FString& resName)
{
FString pakRealPath = FPaths::GameDir().Append(pakPath);
FPakFile tmpPF(*pakRealPath, false);
if (tmpPF.IsValid())
{
FPakPlatformFile* pakPlatformFile = new FPakPlatformFile();
bool res = pakPlatformFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT(""));
if (res)
{
FString mountStr = FPaths::EngineContentDir();
//FPaths::MakeStandardFilename(mountStr);
if (pakPlatformFile->Mount(*pakRealPath, 0, *mountStr))
{
TArray<FStringAssetReference> TargetAssets;
TSet<FString> PakContent;
tmpPF.FindFilesAtPath(PakContent, *tmpPF.GetMountPoint(), true, false, true);
for (TSet<FString>::TConstIterator SetIt(PakContent); SetIt; ++SetIt)
{
FString AssetName = *SetIt;
UE_LOG(LogTemp, Log, TEXT("orig asset name:%s"), *AssetName);
if (AssetName.EndsWith(FPackageName::GetAssetPackageExtension()))
{
FString AssetShortName = FPackageName::GetShortName(AssetName);
AssetShortName.RemoveFromEnd(FPackageName::GetAssetPackageExtension());
AssetName = TEXT("/Engine/") + AssetShortName + TEXT(".") + AssetShortName;
TargetAssets.Add(AssetName);
}
}
UMyGameInstance* MGI = UMyGameInstance::getInst();
if (MGI)
{
FStreamableDelegate StreamableDeleagte = FStreamableDelegate::CreateStatic(&UExternalResBPLib::TestAsyncLoadCallBack);
MGI->getStreamMgr()->RequestAsyncLoad(TargetAssets, StreamableDeleagte);
}
}
}
delete pakPlatformFile;
pakPlatformFile = nullptr;
}
}
void UExternalResBPLib::TestAsyncLoadCallBack()
{
UE_LOG(LogTemp, Log, TEXT("async load end."));
}