Skip to content

Instantly share code, notes, and snippets.

@aikixd
Created December 19, 2019 11:37
Show Gist options
  • Save aikixd/b0decb0cfc28bbdacb46d953691f76fd to your computer and use it in GitHub Desktop.
Save aikixd/b0decb0cfc28bbdacb46d953691f76fd to your computer and use it in GitHub Desktop.
Xenko recepie example

Loading additional asset databases

Xenko accesses physical files through virtual file system abstraction. So in order to access the asset database, you first need to mount the physical directory into the virtual file system.

Once that is done you can instanciate a new content manager by providing it a virtual path to the asset database.

  // Mount the data directory as '/additionalAssets/' virtual path.
  new FileSystemProvider("/additionalAssets/", pathToDataDir);

  // Create the new content manager
  var additionalContet =
      new ContentManager(
          new DatabaseFileProviderService(
              new DatabaseFileProvider(
                  // The 'db' directory and the 'index' file are now accessible through
                  // a virtual path.
                  new Xenko.Core.Storage.ObjectDatabase("/additionalAssets/db", "index"))));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment