🔬Packaged project runtime loading of AW models

This section explains how to use Anything Worlds plugin to load packaged models from our database into your project in runtime. If you are downloading the models in the editor and then cooking your project, you don't need to read this page. This feature is an extra for all those projects that needs to load models into a packaged project that doesn't have our models cooked.

This page is to help you load Anything World models into a packaged project without any models serialized inside. Think that the common workaround is to download the models in editor mode and cook them all together inside your project, but if you need to load models that you haven't serialized in your packaged project, we have implemented the PAK files solution to handle this case. We have created PAK files for all our models to be able to download those models and serialize them in any packaged project.

Pak files are a file format implemented in Unreal Engine to consolidate a collection of assets into a single file for use within a packaged project. Utilizing these files involves following a set of instructions outlined in this documentation. Within our plugin, we offer a suite of tools designed to facilitate the importation of paks in real time from our database and seamless integration into any packaged project featuring our plugin.

Technology

Pak files are containers of cooked assets. By default, if you enable the option to use pak files in Unreal Engine, it will add all the assets in your project to one huge file that will contain all the assets properly cooked.

These files are commonly saved inside the packaged project under the next directory:

<Your Project Folder>
    Content
        Paks

It’s recommendable not to change the path of the pak files because they use relative paths inside your project, and any change in its location is calling for trouble.

Each pak file is composed by:

- <Mounting point>
- <Chunk Id>
- <List of cooked assets>

The mounting point is the relative path of the project that has created the pak and the chunk id is the referred ID of this pak in the packaged project (only used at the moment of packaging the assets).

All the assets inside the pak file are structured based on the mounting point, that is the root for the relative path to all the included assets. Chunk id is the unique component that isn't mandatory. If the user doesn’t set the option to using chunks, the chunk id will be 0 and all the assets will be collected in a single pak.

Warning: Unreal incorporates paks into the project according to their chunk ID, which is utilized during the pak loading process. If there are two paks sharing the same chunk ID, you may encounter unforeseen outcomes when loading assets.

To use the assets inside the pak, you first need to add this mounting point to your project. This will give you access to all the cooked files inside. After that, you can load every asset inside as if was packaged with your project because the project will treat the mounting point as Game/ path.

To check and validate a pak file, you can use UnrealPak.exe tool provided by Unreal. You will find this tool in Program Files\Epic Games\UE_<engine version>\Engine\Binaries\Win64. With this tool, you can check pak file using -List command and verify it using the -Verify. -List command will show you all the files inside the pak with its specific mounting point and -Verify will check for which version of the engine is compiled for and if the pak file is properly generated.

The tool can do much more than only check or verify a pak file but is poorly documented in the Epic Games documentation. This is the complete list of commands of the tool.

UnrealPak <PakFilename> -Test
UnrealPak <PakFilename> -Verify
UnrealPak <PakFilename> -Info
UnrealPak <PakFilename> -List [-ExcludeDeleted]
UnrealPak <PakFilename> <GameUProjectName> <GameFolderName> -ExportDependencies=<OutputFileBase> -NoAssetRegistryCache -ForceDependsGathering
UnrealPak <PakFilename> -Extract <ExtractDir> [-Filter=<filename>]
UnrealPak <PakFilename> -Create=<ResponseFile> [Options]
UnrealPak <PakFilename> -Dest=<MountPoint>
UnrealPak <PakFilename> -Repack [-Output=Path] [-ExcludeDeleted] [Options]
UnrealPak <PakFilename1> <PakFilename2> -diff
UnrealPak <PakFolder> -AuditFiles [-OnlyDeleted] [-CSV=<filename>] [-order=<OrderingFile>] [-SortByOrdering]
UnrealPak <PakFilename> -WhatsAtOffset [offset1] [offset2] [offset3] [...]
UnrealPak <PakFolder> -GeneratePIXMappingFile -OutputPath=<Path>
Options:
  -blocksize=<BlockSize>
  -bitwindow=<BitWindow>
  -compress
  -encrypt
  -order=<OrderingFile>
  -diff (requires 2 filenames first)
  -enginedir (specify engine dir for when using ini encryption configs)
  -projectdir (specify project dir for when using ini encryption configs)
  -encryptionini (specify ini base name to gather encryption settings from)
  -extracttomountpoint (Extract to mount point path of pak file)
  -encryptindex (encrypt the pak file index, making it unusable in unrealpak without supplying the key)
  -compressionformat[s]=<Format[,format2,...]> (set the format(s) to compress with, falling back on failures)
  -encryptionkeyoverrideguid (override the encryption key guid used for encrypting data in this pak file)
  -sign (generate a signature (.sig) file alongside the pak)
  -fallbackOrderForNonUassetFiles (if order is not specified for ubulk/uexp files, figure ou

Limitations

Pak files, much like Uassets, are compatible with a given version of the Unreal Engine. A Pak file created with Unreal Engine 5.1 is viable to use for that specific version of Unreal Engine 5.1 but not prior or later versions.

Pak files are cooked for a specific platform so a Pak file generated on Windows will not be compatible with Android. The reason for this is that the content is cooked for the platform target and the shader graphics language. There are some edge cases where caches and similar platform-agnostic content can be shared across platforms, but as a principle expect to package for each platform.

Unreal Engine stores content assets in particular formats that it uses internally, such as PNG for texture data or WAV for audio. However, this content needs to be converted to different formats for the various platforms, either because the platform uses a proprietary format, does not support the format Unreal uses to store the asset, or a more memory- or performance-effective format exists. The process of converting content from the internal format to the platform-specific format is referred to as cooking. For more information on cooking see the official documentation.

Last updated