Skip to content

Loading Bundles

Swifter edited this page Feb 9, 2025 · 14 revisions

Prerequisites

Loading Bundles

ReMapper uses a "bundle loading" system by parsing the bundleinfo.json file outputted by VivifyTemplate. The point of this system is to create abstractions from what's in the bundle in order to cut down on boilerplate code and make the assets feel more like native objects in the code.

It allows you to:

  • See your available assets in-code (along with their properties)
  • Avoid typing/updating asset paths
  • Update bundle checksums automatically

You can import the bundleinfo.json file at compile time using an import statement at the top of your script.ts file like so:

import * as bundleInfo from './bundleinfo.json' with { type: 'json' }

The rm.loadBundle function will then take in bundleInfo and return a typed list of materials and prefabs from your bundle.

const bundle = rm.loadBundle(bundleInfo)

You can update the bundle checksums automatically for your map by providing the bundleInfo during construction of the pipeline.

const pipeline = await rm.createPipeline({ bundleInfo })

Updating Loaded Bundles

As it stands, Visual Studio Code does not automatically detect changes in the bundleinfo.json file and reimport accordingly.

This means that when you export your bundle again and change assets inside of it, you may not be working with those updated changes in code just yet.

In order to fix this, press Ctrl + Shift + P and run Deno: Restart Language Server. This will force the Deno plugin to reimport bundleinfo.json and your code should be up-to-date with the actual JSON file.

Clone this wiki locally