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
PathSelectorandTagSelectorare supported) defaultbundle, where every asset which shouldn’t go in a specific bundle will be packaged- -
Create a bundle
Note
xkpkgby hand).xkprjfile of the game executable and add the following configuration: Example: MyBundleNamewill embed assets with tagsMyTag1andMyTag2MyBundleName2will embed assets with tagsMyTag3andMyTag4. This bundle has a dependency toMyBundleNamePathSelectorwhich follow the.gitignorefiltering convention.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}):// 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: -
