Player builds
In the Editor, Loom serves your UI from a live dev server with hot reload. In a player build, that dev server doesn’t exist; the UI ships as a pre-built static bundle loaded from the game’s StreamingAssets.
It builds automatically
Loom installs a build hook that runs your UI’s production build on every
player build (File -> Build And Run, or a CI batchmode build). You don’t
have to remember a separate step:
- Unity starts the player build.
- The hook runs your UI’s production build (
npm run build). - If the UI build fails, the player build aborts with the error in the Console, so a broken UI never ships silently.
- Unity finishes building the player with the freshly built UI bundled in StreamingAssets.
To run the UI build on its own without building the player (handy for
checking output), use Loom -> Build UI for Player.
Where the build lands
Your UI’s vite.config.ts writes the production bundle to a dist/ folder
next to it (<ProjectRoot>/UI/dist/). The build hook then copies that dist/ into Assets/StreamingAssets/Loom/, which is where the runtime loads the UI
from in a player build. You don’t point Vite at StreamingAssets yourself, build.outDir must stay dist:
// <ProjectRoot>/UI/vite.config.ts
export default defineConfig({
plugins: [solid(), loom()],
base: './', // required, for relative asset URLs
build: {
outDir: 'dist', // the hook copies UI/dist into StreamingAssets/Loom
emptyOutDir: true,
assetsInlineLimit: 0, // keep assets as separate files
},
}) base: './' is required. The bundle is loaded from local files, not a web
server root, so asset URLs must be relative.
Requirements
- Node.js must be available on the build machine (including CI). The hook
shells out to
npm run build. - Dependencies must be installed. If
UI/node_modulesis missing, the hook skips the build with a warning. RunLoom -> Sync UI Dependenciesfirst. (On CI, run your UI’snpm installas a build step before the Unity build.)
Mock mode does not ship
A player build always runs the connected bridge, it talks to your game’s C#. The mock actions and scenarios you use during development (Mock mode) are inert when the bridge connects to a real engine, so there’s nothing to strip; they simply don’t run.
Checklist before shipping
-
build.outDirisdist,base: './'(the hook copies it intoStreamingAssets/Loom/). -
Loom -> Sync UI Dependencieshas been run (sonode_modulesexists). - Node.js is available wherever you build the player.
-
Loom -> Doctor-> Build cache is green (or just rely on the automatic build hook). - Graphics API and render pipeline match Supported platforms.