4.25如何加载pak

请问~4.25的PAK使用方式是不是改掉了呀~按照之前的方法DBTest的DEMO也是材质无法加载


Super::BeginPlay();

OldPlatform = &FPlatformFileManager::Get().GetPlatformFile();
PakPlatform = MakeShareable(new FPakPlatformFile());
PakPlatform->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT(""));

FPlatformFileManager::Get().SetPlatformFile(*PakPlatform.Get());

FString PakFileFullPath = InPakFullPath;

TSharedPtr<FPakFile> TmpPak = MakeShareable(new FPakFile(PakPlatform.Get(), *PakFileFullPath, false));
FString PakMountPoint = TmpPak->GetMountPoint();
int32 Pos = PakMountPoint.Find("Content/");
FString NewMountPoint = PakMountPoint.RightChop(Pos);
NewMountPoint = FPaths::ProjectDir() + NewMountPoint;
//FString NewMountPoint = "../../../DBJTest/Content/DLC/";

TmpPak->SetMountPoint(*NewMountPoint);

if (PakPlatform->Mount(*PakFileFullPath, 1, *NewMountPoint))
{
	TArray<FString> FoundFilenames;
	TmpPak->FindFilesAtPath(FoundFilenames, *TmpPak->GetMountPoint(), true, false, false);

	if (FoundFilenames.Num() > 0)
	{
		for (FString& Filename : FoundFilenames)
		{
			if (Filename.EndsWith(TEXT(".uasset")))
			{
				FString NewFileName = Filename;
				NewFileName.RemoveFromEnd(TEXT(".uasset"));
				int32 Pos = NewFileName.Find("/Content/");
				NewFileName = NewFileName.RightChop(Pos + 8);
				NewFileName = "/Game" + NewFileName;

				UObject* LoadedObj = StaticLoadObject(UObject::StaticClass(), NULL, *NewFileName);

				UStaticMesh* SM = Cast<UStaticMesh>(LoadedObj);
				if (SM)
				{
					AStaticMeshActor* MeshActor = GetWorld()->SpawnActor<AStaticMeshActor>(AStaticMeshActor::StaticClass(), FVector(0,0,460), FRotator(0,0,0) );
					MeshActor->SetMobility(EComponentMobility::Movable);
					MeshActor->GetStaticMeshComponent()->SetStaticMesh(SM);
					break;
				}
			}
		}
	}
}

FPlatformFileManager::Get().SetPlatformFile(*OldPlatform);

报错日志:

[2020.05.12-02.32.17:463][ 61]LogShaders: Error: Missing shader resource for hash ‘A477F9398E49CEDB45E09721490DA0FE25701828’ for shader platform 0 in the shader library

[2020.05.12-02.32.17:463][ 61]LogMaterial: Error: Tried to access an uncooked shader map ID in a cooked application

[2020.05.12-02.32.17:463][ 61]LogMaterial: Warning: Invalid shader map ID caching shaders for ‘M_Base’, will use default material.

[2020.05.12-02.32.17:463][ 61]LogMaterial: Can’t compile M_Base with cooked content, will use default material instead


查看4.25的版本日志,好像还支持PAK再Editor下的加载,可是如何尝试好像还是和以前一样的错误。
尝试了好几天了~请问有大佬知道如何再4.25下正确使用PAK以及再调式时候加载PAK么?能否指点几篇相关文章或DEMO

thank you very much

Hi mywork,

We were having the same issue and upgrading to version 4.25.1 resolved the issue for us.

Kind regards,
Stijn