Asset Library API
The single surface for platform-provided assets, covering two delivery modes:
Referenced asset packs — packs imported by reference from the RUN.world asset library. A referenced pack's files stay on the shared asset CDN instead of being copied into your project; the SDK gives you the URL prefix for a pinned pack version, and you append each file's pack-relative path.
Shared asset bundles — host-provisioned bundles loaded as raw bytes. Hosts serve an embedded copy from disk when one ships in the app, falling back to the CDN otherwise.
Quick Start
import RundotGameAPI from '@series-inc/rundot-game-sdk/api'
// Referenced asset packs: resolve the pinned pack's URL prefix
const base = await RundotGameAPI.assetLibrary.getPackBaseUrl(
'3D/dungeon/kenney-pirate-pack', // packId
'abc123def456', // version
)
const ship = await gltfLoader.loadAsync(`${base}/models/ship.glb`)
// Shared asset bundles: load raw bytes (embedded copy preferred)
const bundleBuffer = await RundotGameAPI.assetLibrary.loadAssetsBundle(
'burger-time',
'characters',
)
console.log('Bundle bytes:', bundleBuffer.byteLength)API Reference
getPackBaseUrl(packId: string, version: string): Promise<string>
packIdandversionidentify a pinned, immutable snapshot of an asset pack. For packs imported into a studio project by reference, both are recorded inpublic/assets/<pack-slug>/referenced-files.jsonalongside each file's pack-relativepath.Resolves with a URL prefix (no trailing slash). Append a file's pack-relative path to get its full URL.
The content behind a
(packId, version)pair never changes — URLs are safe to cache and work identically in the studio preview and the published game.Resolution is host-aware: inside the RUN.world app the host supplies the current CDN location, so games keep working even if the platform relocates asset storage. Outside a host (studio preview, playground) or on an older host, the SDK falls back to the default asset-library CDN.
loadAssetsBundle(game: string, bundleKey: string, fileType?: string): Promise<ArrayBuffer>
Resolves with raw bundle bytes (ArrayBuffer). Hand them to your own decompressor, asset loader, etc.
game
string
Yes
-
The CDN namespace for the bundle (typically the game that owns the assets). Only used to build the CDN fallback URL; see the hint below.
bundleKey
string
Yes
-
Identifies the bundle. On the RPC path this is the only field the host uses to resolve the asset; it is also the filename stem in the CDN fallback URL.
fileType
string
No
'stow'
File extension used when building the CDN fallback URL ({game}/{bundleKey}.{fileType}).
Host implementations attempt to load via RPC first (serving an embedded copy from disk when one ships in the app) and fall back to the CDN when the RPC lookup fails. Keep CDN and embedded assets in sync.
Cross-game bundle loading, the currently available bundles, and the base64 decoding helpers are documented on the Shared Assets page; everything there applies to assetLibrary.loadAssetsBundle unchanged.
Why not hard-code pack URLs?
A referenced pack manifest's url values work as-is today, but they pin your game to the CDN's current physical location forever. getPackBaseUrl resolves the location at runtime through the host, which keeps published games working if asset storage ever moves. Prefer it whenever your project's SDK version provides RundotGameAPI.assetLibrary.
Fetching a whole referenced pack
Last updated