Uasset will not load with SynchronousLoad()

Hi,

I’m trying to add assets dynamically from the internet. First I create a .pak-file with a single sphere via command line and loading it from a local path. With the command line I tested and extracted the .pak-file. Everything seems to be good with this file. But i get problems with the StreamableManager. Can somebody help?

Here my steps of the following code:

  1. loading the .pak-file and mount it to my engine directory
  2. searching for the .uasset files and print names and count in console
  3. Loading the assets with a FStreamableManager.synchonousload()

Thats my OUTPUT:

LogTemp:Error: VALID pak file: C:/Users/Nils/Desktop/out.pak
LogTemp:Error: Number of assets = 1
LogTemp:Error: Find asset = ../../../Engine/Content/Sphere.uasset
**LogUObjectGlobals:Warning: Failed to find object 'Object None../../../Engine/Content/Sphere.uasset'
LogStreamableManager: Failed attempt to load ../../../Engine/Content/Sphere.uasset**

CODE:

   IPlatformFile&    PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
    FPakPlatformFile* PakPlatform  = new FPakPlatformFile();   
    PakPlatform->Initialize(&PlatformFile, TEXT(""));
    FPlatformFileManager::Get().SetPlatformFile( *PakPlatform );
   
    const FString PakFileName = TEXT("C:/Users/Nils/Desktop/out.pak");

    FPakFile PakFile(*PakFileName, false);

    if (!PakFile.IsValid())
        UE_LOG(LogTemp, Error, TEXT("INVALID pak file: %s"), *PakFileName);
    if (PakFile.IsValid())
        UE_LOG(LogTemp, Error, TEXT("VALID pak file: %s"), *PakFileName);

    PakFile.SetMountPoint(*FPaths::EngineContentDir());

    const int32 PakOrder = 0;
    if ( !PakPlatform->Mount(*PakFileName, PakOrder, *FPaths::EngineContentDir()))
        UE_LOG(LogTemp, Error, TEXT("Failed to mount pak file: %s"), *PakFileName);

    TSet<FString> FileList;
    PakFile.FindFilesAtPath(FileList, *PakFile.GetMountPoint(), true, false, true);

    UE_LOG(LogTemp, Error, TEXT("Number of assets = %ld"), FileList.Num());
    
    StreamedAssets.Empty();
    for (TSet<FString>::TConstIterator FileItem(FileList); FileItem; ++FileItem)
    {
        FString AssetName = *FileItem;
        UE_LOG(LogTemp, Error, TEXT("Find asset = %s"), *AssetName);

        if (AssetName.EndsWith(FPackageName::GetAssetPackageExtension()) || AssetName.EndsWith(FPackageName::GetMapPackageExtension()))
            StreamedAssets.Add(AssetName);
    }

    UObject *object = Cast<UStaticMesh>( AssetLoader->SynchronousLoad(StreamedAssets[0]));

Hey Nils1689-

I have entered a feature request for documentation/tutorial on the correct use/syntax for SynchronousLoad(). For the time being, you may want to post your question on the forums as well in order to get feedback from other community members.

Cheers

Hi, Is there any progress about this?

Hey -

Currently our resources are dedicated elsewhere and UEDOC-3185 is not a priority item for us to work on. We don’t have a timeframe for when this may be addressed.