@babylonjs/inspector

中文文档
9.35.0发布于 2026/11/07Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 17.2万

The Babylon Inspector is a diagnostic tool that makes it possible to view and edit the scene graph, properties of entities within the scene, and more.

原始使用文档
文档目录4 节
  1. Installation
  2. Babylon Lite
  3. Headless Inspectable (No UI)
  4. Inspector CLI

BabylonJS Inspector

The Babylon Inspector is a diagnostic tool that makes it possible to view and edit the scene graph, properties of entities within the scene, and more.

You can learn more in the Inspector documentation.

Installation

Install the package using npm:

npm install @babylonjs/inspector

The simplest way to use Inspector is to call the ShowInspector function, passing in your scene:

import { ShowInspector } from "@babylonjs/inspector";

// Your code that sets up a Babylon.js scene...

ShowInspector(scene);

Babylon Lite

The initial Babylon Lite Inspector can display the surfaces and rendering contexts associated with an engine:

import { ShowInspector } from "@babylonjs/inspector/lite";

ShowInspector(engine);

Headless Inspectable (No UI)

You can make a scene inspectable for the CLI without showing the Inspector UI by calling StartInspectable:

import { StartInspectable } from "@babylonjs/inspector";

// Your code that sets up a Babylon.js scene...

const token = StartInspectable(scene);

// When you're done, dispose the token to disconnect:
token.dispose();

StartInspectable connects the scene to the Inspector CLI bridge, enabling CLI commands like querying entities, taking screenshots, and capturing performance traces — all without rendering any Inspector UI. ShowInspector automatically calls StartInspectable internally.

Inspector CLI

While the Inspector UI is designed for humans, the Inspector CLI is designed for AI agents. It provides machine-friendly JSON output for querying scene entities, capturing screenshots, collecting performance data, and more.

To get started:

npx @babylonjs/inspector --help

版本与发布记录

@babylonjs/inspector 共发布 895 个版本,首次发布于 2019/01/11;过去 12 个月发布了 172 个版本。

版本发布日期距今
9.35.0latest2026/11/071 天前
9.34.02026/11/052 天前
9.33.32026/11/052 天前
9.33.22026/11/035 天前
9.33.12026/10/308 天前
9.33.02026/10/299 天前

其他发布通道:preview → 8.48.1-preview。

关于 @babylonjs/inspector 的常见问题

@babylonjs/inspector 是什么?

The Babylon Inspector is a diagnostic tool that makes it possible to view and edit the scene graph, properties of entities within the scene, and more.

如何安装 @babylonjs/inspector?

在项目目录运行 npm install @babylonjs/inspector,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=16.14.0 <20.0.0)、react-dom(>=16.14.0 <20.0.0)、usehooks-ts(^3.1.1)、@babylonjs/gui(^9.0.0)、@babylonjs/core(^9.0.0)、@babylonjs/addons(^9.0.0)、@babylonjs/loaders(^9.0.0)、@babylonjs/materials(^9.0.0)、@babylonjs/gui-editor(^9.0.0)、@fluentui/react-icons(^2.0.310)、@babylonjs/node-editor(^9.0.0)、@babylonjs/serializers(^9.0.0)、@fluentui/react-charts(^9.3.27)、@fluentui/react-utilities(^9.26.2)、@fluentui/react-components(^9.70.0)、@babylonjs/node-geometry-editor(^9.0.0)、@babylonjs/node-particle-editor(^9.0.0)、@babylonjs/node-render-graph-editor(^9.0.0)、@fluentui-contrib/react-virtualizer(^1.0.0)、@fluentui-contrib/react-resize-handle(^0.8.4)、@fluentui/react-motion-components-preview(^0.15.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 babylon-inspector,可以用 npx babylon-inspector 直接运行。

@babylonjs/inspector 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@babylonjs/inspector 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@babylonjs/inspector 可以商用吗?

@babylonjs/inspector 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@babylonjs/inspector 的下载量有多少?

根据 npm 官方下载统计,@babylonjs/inspector 在 2026/10/08 – 2026/11/06 这 30 天内被下载 171,825 次,日均约 5,728 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@babylonjs/inspector 还在维护吗?

最新版本 9.35.0 发布于 2026/11/07(1 天前);至今共发布 895 个版本,其中过去 12 个月发布了 172 个;首次发布于 2019/01/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。