Asset bundles

Warning

This section is out of date. For now, you should only use it for reference. A bundle of assets allows to package assets into a single archive that can be downloaded into the game at a specific time. Downloadable Content (DLC). Basic rules:

  • assets selectors (Currently, only the PathSelector and TagSelector are supported)
  • default bundle, where every asset which shouldn’t go in a specific bundle will be packaged
  • -

    Create a bundle

    Note
    xkpkg by hand). xkprj file of the game executable and add the following configuration: Example:
  • MyBundleName will embed assets with tags MyTag1 and MyTag2
  • MyBundleName2 will embed assets with tags MyTag3 and MyTag4. This bundle has a dependency to MyBundleName
  • PathSelector which follow the .gitignore filtering convention.
    1. Bundles: - Name: MyBundleName Selectors: - !TagSelector Tags: - MyTag1 - MyTag2 - Name: MyBundleName2 Dependencies: - MyBundleName Selectors: - !TagSelector Tags: - MyTag3 - MyTag4 - !PathSelector Paths: - folder1/ - /folder2/ - *.bin - folder3/*.xml
    Note
    Asset dependencies are automatically placed in the most appropriate bundle. Current process works that way:
  • -
  • Place everything else in default bundle.Note that:
  • Shared assets might be duplicated if not specifically placed in common or default package, but that is intended (i.e. if user wishes to distribute 2 separate DLC that need common assets but need to be self-contained). -

    Load a bundle at runtime

    ObjectDatabase.LoadBundle(string bundleName) (ref:{Xenko.Core.Storage.ObjectDatabase.LoadBundle}):
    1. // Load bundleAssets.DatabaseFileProvider.ObjectDatabase.LoadBundle("MyBundleName2");// Load specified assetvar texture = Assets.Load<Texture2D>("AssetContainedInMyBundleName2");

    Selectors

    Selectors help deciding which assets are stored in a specific bundle.

    Tag selector

    Select assets based on a list of tag attached on each asset. Properties: -

    Path selector

    Select assets based on their path. Standard .gitignore patterns are supported (except ! (negate), # (comments) and [0-9] (groups)). Properties: -