FAQ: Packaging

Mar 9, 2021.Knowledge

Q: What is the correct “procedure” to define primary asset types? Is it just adding a line into DefaultGame.ini, [/Script/Engine.AssetManagerSettings] as PrimaryAssetTypesToScan?

  • The procedure is covered in our Asset Management docs, you can take a look at the ActionRPG sample for a good example.

Q: What is the suggested flow to assign assets to chunks? Organizing them into the collections?

  • There isn’t a single suggested flow, the Cooking and Chunking doc discusses multiple options. The one thing we plan to add to that doc is how to actually make a label, it’s via Create Advanced Asset->Miscellaneous->DataAsset then picking label as the type.

Q: Do we only need to assign the Primary assets to the collection, or all assets we want to be in the chunk? Will a Primary asset automatically pull all its referenced assets into its chunk, or do we need to assign Secondary assets to the collections manually?

  • If the collection or tagged directory includes primary assets, it will also grab any secondary assets that are not already assigned to a primary asset with a higher priority. The best example of basic dependency setup is in the ShooterGame sample. You can look at the label assets in the Maps folder. New labels can be defined by making a DataAsset, as they are a subclass of that.
  • For resolving multiple dependencies, it uses the Priority of the label (or ini setting). It basically starts with the highest priority and works down, so if you have a priority 2 map and a priority 1 map, all assets shared by both would end up in the pak of the map assigned priority 2. However, if the maps have the same priority, it will actually put the shared assets in BOTH pak files, and the engine will use the copy in the last-added pak file. This is useful if you’re doing something like downloading paks on demand, but if they’re all on disk you probably want to set priorities to avoid it.
  • All of this logic is controlled by virtual functions in the AssetManager, if you’re doing anything complicated with soft prs then you’re probably going to have to subclass and override some because the engine can only do so much to guess at your data layout. The logic mentioned is implemented in UAssetManager::ShouldSetManager, but you can also override GetPackageChunkIds and other functions if needed. All your changes can be previewed in the editor as described in the Cooking and Chunking doc page. You can also set many overrides in the AssetManager project settings instead of using labels.

Q: What are the ways to list assets per chunk, as well as to list the assets from the content that were not included into any of the chunks?

  • Covered in Cooking and Chunking under “Analyzing Asset-to-Chunk Assignments. Anything not assigned to a chunk will end up in chunk 0, so you can inspect that chunk.

Q: How does patching work with chunks? Will each patched chunk will have its own patch package created? Or there will be a single patch for all chunks, even those that are only downloaded on demand?

  • Patching is currently done in a very game-specific way for Fortnite and Battle Breakers, and none of that code is available in the engine since it hasn’t been generalized to work with other projects. We’re hoping to have some of that functionality available to share soon

Q: Any suggestions on how to organize PAK files with materials, textures, meshes, etc.?

  • We use the FileOpenOrder, which arranges them in the order they are loaded in.
  • It runs through the game once to create the FileOpenOrder.
  • There might still be some cases it does not get loaded in the optimal order, we have considered grouping by asset types such as textures.