x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I call uasset that is loaded from memory in Pak?

How do I call uasset that is loaded from memory in Pak? MountPak Successful and SynchronousLoad Successful ,But I don't know how to call uasset that is loaded from memory in Pak.Please help me. Thank you very much.

Code:`

              FString SaveContentDir = FPaths::ProjectContentDir()+ TEXT("Paks/newout.pak");
     IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
     FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
     PakPlatformFile->Initialize(&PlatformFile, TEXT(""));
     FPlatformFileManager::Get().SetPlatformFile(*PakPlatformFile);
     FPakFile PakFile(&PlatformFile, *SaveContentDir, false);
     FString MountPoint("../../../codetest04/Topak/");
     PakFile.SetMountPoint(*MountPoint);
     if (PakPlatformFile->Mount(*SaveContentDir, 0, *MountPoint))
     {
         GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("OnMountPak.Execute Successful.%s" + SaveContentDir));
         UE_LOG(YourLog, Warning, TEXT("Mount Success"));
         TArray<FString> AssetsToLoad;
         TArray<FString> FileList;
         PakFile.FindFilesAtPath(FileList, *PakFile.GetMountPoint(), true, false, true);
         FStreamableManager StreamableManager;
         FString AssetName = FileList[10];
         FString AssetShortName = FPackageName::GetShortName(AssetName);
         FString LeftStr;
         FString RightStr;
         AssetShortName.Split(TEXT("."), &LeftStr, &RightStr);
         AssetName = TEXT("/Game/Topak/") + LeftStr + TEXT(".") + LeftStr;    
         FStringAssetReference reference = AssetName;
         UObject* LoadObject = StreamableManager.SynchronousLoad(reference);
                     
         if (LoadObject != nullptr)
         {
                                             
                 UStaticMesh* Obj = Cast<UStaticMesh>(LoadObject);
                 if (Obj!= nullptr)
                 {                        
                     
                     
                     UE_LOG(YourLog, Warning, TEXT("SynchronousLoad success !!!"))
                         GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("SynchronousLoad success !!!" ));
                 }
                 else
                 {
                     UE_LOG(YourLog, Warning, TEXT("SynchronousLoad failed !!!"))
                         GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("SynchronousLoad failed !!!"));
                 }
                     }`
Product Version: UE 4.18
Tags:
more ▼

asked Sep 29 '18 at 03:52 AM in C++ Programming

avatar image

月光123
1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question