Load asset from .pak file,mount success,but synchronousLoad failed attempt to load,Does anyone know how to solve this problem? Thank you very much.
code:
FString MountPoint(FPaths::EngineContentDir());
PakFile.SetMountPoint(*MountPoint);
if (PakPlatformFile->Mount(*SaveContentDir, 0, *MountPoint))
{
UE_LOG(YourLog, Warning, TEXT("Mount Success"));
TArray<FString> AssetsToLoad;
TArray<FString> FileList;
PakFile.FindFilesAtPath(FileList, *PakFile.GetMountPoint(), true, false, true);
FStreamableManager* StreamableManager = new FStreamableManager();
FString AssetName = FileList[10];
FString AssetShortName = FPackageName::GetShortName(AssetName);
FString LeftStr;
FString RightStr;
AssetShortName.Split(TEXT("."), &LeftStr, &RightStr);
AssetName = TEXT("/Engine/") + LeftStr + TEXT(".") + LeftStr;
FStringAssetReference reference = AssetName;
UObject* LoadObject = StreamableManager->SynchronousLoad(reference);
if (LoadObject != nullptr)
{
UE_LOG(YourLog, Warning, TEXT("Object Load Success..."))
}
else
{
UE_LOG(YourLog, Warning, TEXT("Can not Load asset..."))
}`
error message:
LogTemp: Warning: ----------- LoadPak: ../../../../../Unreal Projects/codetest03/Content/newout.pak --------------
YourLog: Warning: not load pak ../../../../../Unreal Projects/codetest03/Content/newout.pak
YourLog: Warning: Mount Success
YourLog: Warning: Pak ALL Path ../../../Engine/Content/
YourLog: Warning: Pathname... /Engine/003.uasset
LogStreamableManager: Failed attempt to load /Engine/003.uasset
YourLog: Warning: Can not Load asset...