Skip to content

Pixi Plugin

The PixiPlugin bootstraps the PixiJS Application and wires all Pixi-related systems into the ECS world.


import { PixiPlugin } from '@shell/pixi';
world.addPlugin(PixiPlugin);

This is the simplest setup. It registers components, systems, resources, and spawns a default camera entity.


PixiPlugin accepts all pixi.js ApplicationOptions plus one additional option:

interface PixiPluginOptions extends ApplicationOptions {
spawnCamera?: boolean; // default: true
}
OptionTypeDefaultDescription
spawnCamerabooleantrueWhether to spawn a camera at startup.

PixiJS options are passed through to PixiApp.setOptions():

world.addPlugin(PixiPlugin, {
backgroundColor: 0x000000,
antialias: true,
spawnCamera: false,
});

  • Sprite
  • Text
  • PixiTransformGroup
  • PixiRenderLayer
  • Tint
  • Texture
  • NineSlice
  • Camera
  • pixiApp — PixiApp instance
  • pixiAssets — PixiJS Assets
  • pixiNodes — PixiNodeRegistry with logical groups and role-owned nodes
SystemScheduleOrdering
CameraSyncSchedule.RenderBefore node synchronization
PixiTransformGroupInitSchedule.RenderBefore concrete node creation
Sprite and text syncSchedule.RenderBefore generic transform sync
PixiRenderLayerSyncSchedule.RenderRoutes nodes to world or UI
Transform and pivot syncSchedule.RenderAfter concrete node creation
TickerSchedule.RenderAfter all synchronization

If spawnCamera is true (the default), a CameraPrefab entity is spawned during startup.


PixiJS creates a <canvas> element. If the consumer does not provide a canvas via ApplicationOptions, the plugin appends the auto-created canvas to a DOM element with id="pixi-container":

<div id="pixi-container"></div>

If no container is found, the plugin throws an assertion error.


If you want full control over the camera or other setup, pass spawnCamera: false and spawn your own camera entity:

import { Define } from '@shell/ecs';
import { Camera, PixiPlugin } from '@shell/pixi';
import { Position, Rotation } from '@shell/transform';
world.addPlugin(PixiPlugin, { spawnCamera: false });
commands.spawn(
Define.prefab()
.with(Position, { x: 0, y: 0 })
.with(Camera, { zoom: 1 })
.with(Rotation, { x: 0, y: 0, z: 0 }),
);