Click a sprite.
Get the line that made it.

PixiTools is an inspector and a profiler that run inside the page, next to your Pixi game. Pick anything and see what it is, the texture and tint it draws with, and the file and line that created it.

$npm install --save-dev github:joydle/PixiTools

Click the water and the frog leaps there; land on the dragonfly to catch it. ` picks. Add fireflies adds 1,500 sprites that alternate blend mode, so no two can share a draw call; Batch them draws the same sprites in one. The game is site/demo.js, with no build step; open it on its own page.

What it does

Built for our own game tools, where the one asking is often an agent.

Picks anything
Sprites, graphics, text and containers by their bounds, HUD elements by geometry, and the one on top when they overlap. The game is paused for real: the ticker is stopped and no input reaches it.
The line that made it
File, line and the text of the line, for every sprite, graphic, text, mesh and container your code constructs.
What it is drawn with
The texture by name, the tint, the filters and mask attached, visible and renderable here and in every parent. A field Pixi has no concept of is left out, never a made-up zero.
Errors with their source
Uncaught errors, rejected promises and console.error, each mapped back to the line.
Every frame, measured
Frame time and percentiles, CPU and GPU time, draw calls and triangles counted at the WebGL calls, state changes, long frames. Texture memory is an estimate.
What is slow, in words
A 0–100 score, the bottleneck, and warnings with the number that tripped them and what to try. Snapshots per build show what a change cost.

For agents

Everything the panel shows, a script can ask for. Asking never pauses, selects or draws.

in the page — from a test, a script or a coding agent's browser

const { inspector, profiler } = window.__pixitools;

await inspector.agent.at(640, 360);    // what is at this pixel: HUD first, then objects, topmost first
await inspector.agent.named('frog');   // by name
inspector.agent.tree();                // the scene graph and the HUD, as one tree
await inspector.agent.errors();        // runtime errors, each with its source line
profiler.getReport();                  // the frame profile as Markdown

one hit

{
  "kind": "object",
  "name": "goldie",
  "metadata": {
    "typeName": "Sprite",
    "position": { "x": 230.4, "y": 291.5 },
    "texture": "koi.png",
    "tint": "#ff9a3c",
    "originalSource": "/demo.js",
    "originalLine": 33,
    "originalSourceLine": "const goldie = new Sprite({ texture: fishTexture, tint: '#ff9a3c', label: 'goldie', anchor: 0.5 });"
  }
}

In the panel, Copy for agent puts the same facts on the clipboard as text, and Copy report the profile. Inside an editor's iframe the tools speak postMessage instead: the protocol is a dozen messages.

Use

One call for the panel. One plugin line for source lines.

  1. AttachPass the application. You have picking, the tree and the profiler.
  2. Add the pluginIn dev, pixi.js becomes a wrapper that records each object's line.
  3. Ship as beforeThe plugin does nothing in a build; the tools never reach it.

any Pixi v8 page

import * as PIXI from 'pixi.js';
import { attach } from '@joydle/pixitools';

attach({ PIXI, app });

with Vite — vite.config.js, then your entry

import pixitools from '@joydle/pixitools/vite';

export default { plugins: [pixitools()] };

// main.js: the wrapper finds the application itself
if (import.meta.env.DEV) {
  const { attach } = await import('@joydle/pixitools');
  attach();
}

no bundler — an import map

<script type="importmap">
{
  "imports": {
    "pixi.js": "./lib/pixitools.pixi.js",
    "@joydle/pixitools": "./lib/pixitools.js"
  },
  "scopes": {
    "./lib/": { "pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8.23.0/dist/pixi.mjs" }
  }
}
</script>

Works with Pixi v8, WebGL renderer. It is a dev tool: it wraps the WebGL draw calls to count them, and the wrapper turns on preserveDrawingBuffer so screenshots are never blank.