diff --git a/docs/user-manual/scripting/debugging/browser-dev-tools.md b/docs/user-manual/debugging/browser-dev-tools.md similarity index 95% rename from docs/user-manual/scripting/debugging/browser-dev-tools.md rename to docs/user-manual/debugging/browser-dev-tools.md index 48e446f7991..370c3aa9f76 100644 --- a/docs/user-manual/scripting/debugging/browser-dev-tools.md +++ b/docs/user-manual/debugging/browser-dev-tools.md @@ -11,11 +11,11 @@ Chrome, Firefox and other browsers have Developer Tools integrated directly into In order to debug your scripts, select the Sources tab in Developer Tools (Chrome). Open the 'navigator' by clicking the icon in the top left corner of the Sources pane. You should see something similar to what is shown below: -![Debugger](/img/user-manual/scripting/debugging/chrome-debugger.png) +![Debugger](/img/user-manual/debugging/chrome-debugger.png) In Firefox it looks like this: -![Firefox](/img/user-manual/scripting/debugging/firefox-debugger.png) +![Firefox](/img/user-manual/debugging/firefox-debugger.png) The navigator lists all of the scripts currently running in the active tab, including any PlayCanvas scripts that you have written. Find one of your scripts in the navigator and select it to open the source code. You are now able to set breakpoints and debug. diff --git a/docs/user-manual/scripting/debugging/console-logging.md b/docs/user-manual/debugging/console-logging.md similarity index 100% rename from docs/user-manual/scripting/debugging/console-logging.md rename to docs/user-manual/debugging/console-logging.md diff --git a/docs/user-manual/scripting/debugging/index.md b/docs/user-manual/debugging/index.md similarity index 55% rename from docs/user-manual/scripting/debugging/index.md rename to docs/user-manual/debugging/index.md index f1676e37ddb..f725291e475 100644 --- a/docs/user-manual/scripting/debugging/index.md +++ b/docs/user-manual/debugging/index.md @@ -1,9 +1,9 @@ --- title: Debugging -description: Tools and techniques for finding and fixing bugs in your PlayCanvas scripts using browser developer tools. +description: Tools and techniques for finding and fixing bugs in PlayCanvas applications, with logging, the browser developer tools, the Inspector and debug drawing. --- -Debugging is essential for identifying and fixing issues in your PlayCanvas scripts. When your code doesn't behave as expected, these tools and techniques will help you quickly find and resolve problems. +Debugging is essential for identifying and fixing issues in your PlayCanvas application, in its scripts as well as in what it renders and loads. When it doesn't behave as expected, these tools and techniques will help you quickly find and resolve problems. To find out why it runs slowly, see [Which Tool to Use](/user-manual/optimization/#which-tool-to-use). ## Debugging Techniques @@ -24,3 +24,9 @@ Use breakpoints, step-through debugging, and performance profiling to deeply ins Look inside the running application: its entities and components, cameras, assets and GPU resources, the passes of each frame, and the draws of a pass one at a time. **[Learn the Inspector →](./inspector.md)** + +### Debug Drawing + +Draw lines, shapes and textures over the scene to see what your code computes, such as bounds and directions, or the content of a render target and the depth of the scene. + +**[Learn Debug Drawing →](/user-manual/graphics/debug-drawing/)** diff --git a/docs/user-manual/scripting/debugging/inspector.md b/docs/user-manual/debugging/inspector.md similarity index 88% rename from docs/user-manual/scripting/debugging/inspector.md rename to docs/user-manual/debugging/inspector.md index 961d7da203f..778f32c4e7f 100644 --- a/docs/user-manual/scripting/debugging/inspector.md +++ b/docs/user-manual/debugging/inspector.md @@ -1,11 +1,11 @@ --- title: Inspector -description: Inspect a running PlayCanvas application in a debug panel - its entities, cameras, assets, frame graph, GPU resources, scripts and shaders - and step through the draws of a frame. +description: Inspect a running PlayCanvas application in a debug panel - its entities, cameras, assets, frame graph, GPU resources, scripts and shaders - step through the draws of a frame, and record its performance. --- The Inspector is a debug panel for a running PlayCanvas application. It docks over the canvas and shows the application's scene, GPU resources and rendered frames as they are now, with the properties of whatever you select updating live below. -The Inspector panel docked beside a running application, with an entity selected in the hierarchy +The Inspector panel docked beside a running application, with an entity selected in the hierarchy Use it to answer questions such as: @@ -13,6 +13,7 @@ Use it to answer questions such as: - Which material and shader does a mesh draw with, and which textures does it use? - What does a frame render, in which passes and in what order? - Where does the video memory go? +- Which frames are slow, and what holds them back? The Inspector only reads the application. The changes it makes are the ones you ask for: turning entities on and off, pausing and stepping the application, and view-only overrides (render modes, wireframe and a flown or orbited camera), which it removes when it closes. @@ -56,6 +57,7 @@ app.root.addChild(entity); | `toggleKey` | `` 'Backquote' `` | The key that shows and hides the panel. | | `pauseKey` | `'F9'` | The key that pauses and resumes the application. | | `stepKey` | `'F10'` | The key that advances one frame while paused. | +| `record` | `false` | Whether to start recording frames on the Performance tab. Created before the application's first frame, the Inspector records its start too, see [Recording the Start of the Application](/user-manual/optimization/inspector-performance/#recording-the-start-of-the-application). | | `storageKey` | `'pc-inspector'` | The local storage key the panel's settings are kept under, such as the active tab and the panel width. `null` keeps nothing. | ## The Toolbar @@ -82,6 +84,7 @@ Each tab lists one kind of object, and the property view below it shows the sele | **Cameras** | The cameras in render order, with where each draws. A render mode shows the scene's material inputs instead of the final image, such as albedo, world normals or lighting, for one camera or all of them, and the scene can be drawn in wireframe. | | **Assets** | Every asset in the registry, with its file, its load state and what uses it. | | **Frame graph** | The passes that rendered the last frame, in order, with the layers, draws and render targets of each. **GPU timings** shows the time each pass takes on the GPU where the device can measure it, **Freeze** keeps showing the current frame while the application runs on, and **Preview** draws the selected pass's render target over the view. | +| **Performance** | Records the frames of the application and charts their frame, CPU, GPU and script times, what loaded, memory and resources over time, with each frame on a timeline of its own. See [Inspector Performance](/user-manual/optimization/inspector-performance/). | | **Render targets** | The render targets on the device, with the passes that rendered into them and a live preview of a chosen attachment. | | **Textures** | The textures on the device, largest first, with a live preview and a choice of channels to show. | | **Meshes** | The meshes of the application, largest first, with their geometry and what uses them. | @@ -91,7 +94,7 @@ Each tab lists one kind of object, and the property view below it shows the sele | **Shaders** | The compiled shaders, with their sources. | | **Physics** | The rigid bodies and joints of the physics world, and an option to draw the world over the scene. | -The Frame graph tab, with the forward pass selected and its render target previewed over the view +The Frame graph tab, with the forward pass selected and its render target previewed over the view ## Stepping Through a Frame @@ -102,7 +105,7 @@ The Frame graph tab can draw a frame one draw call at a time, to see how the ima 3. Press the Up and Down arrow keys to step back and forward one draw at a time. The property view lists the drawn mesh instances with the current one highlighted, the view outlines it, and the status bar shows its number, such as *draw 8 of 12 · World opaque*. Expand an entry to see more about it, such as its mesh and material. 4. Turn off **Debug frame** to draw the full frame again. -Stepping through the draws of the World layer one at a time +Stepping through the draws of the World layer one at a time :::note Stepping through draws needs the debug build of the engine, and the option is disabled with other builds. Bundlers such as Vite pick the debug build in development through the `development` export condition of the `playcanvas` package. diff --git a/docs/user-manual/getting-started/migrating-from-unity.md b/docs/user-manual/getting-started/migrating-from-unity.md index f47081ca987..24d7a98fd48 100644 --- a/docs/user-manual/getting-started/migrating-from-unity.md +++ b/docs/user-manual/getting-started/migrating-from-unity.md @@ -52,7 +52,7 @@ The Launch Page stays connected to the Editor. Changes to entities, components, Scripts never run in the Editor's viewport, so there is nothing like Unity's `[ExecuteInEditMode]`: anything a script creates or changes appears only in the launched app. -The Launch button's menu has options for testing: choose the graphics API, open the [Profiler](/user-manual/optimization/profiler/), [MiniStats](/user-manual/optimization/mini-stats/) or [Inspector](/user-manual/scripting/debugging/inspector/), and tick **Debug** to log the engine's warnings and errors to the console. +The Launch button's menu has options for testing: choose the graphics API, open the [Profiler](/user-manual/optimization/profiler/), [MiniStats](/user-manual/optimization/mini-stats/) or [Inspector](/user-manual/debugging/inspector/), and tick **Debug** to log the engine's warnings and errors to the console. ### Navigating the Viewport {#navigating-the-viewport} @@ -641,11 +641,11 @@ Your app runs in the browser, so you debug it with the browser's developer tools | Unity | PlayCanvas | | --- | --- | -| Console window | The **Console** tab of the developer tools. See [Console Logging](/user-manual/scripting/debugging/console-logging/). | -| Attaching Visual Studio or Rider | Breakpoints in the **Sources** tab of the developer tools. See [Browser Dev Tools](/user-manual/scripting/debugging/browser-dev-tools/). | +| Console window | The **Console** tab of the developer tools. See [Console Logging](/user-manual/debugging/console-logging/). | +| Attaching Visual Studio or Rider | Breakpoints in the **Sources** tab of the developer tools. See [Browser Dev Tools](/user-manual/debugging/browser-dev-tools/). | | `Debug.Break()` | A `debugger;` statement, which pauses the app while the developer tools are open | | Profiler | The [Profiler](/user-manual/optimization/profiler/) and [MiniStats](/user-manual/optimization/mini-stats/), from the Launch button's menu, and the **Performance** tab of the developer tools | -| Frame Debugger | The [Inspector](/user-manual/scripting/debugging/inspector/), also from the Launch button's menu, which shows the render passes and draw calls of each frame, and [native GPU profilers](/user-manual/optimization/gpu-profiling/) | +| Frame Debugger | The [Inspector](/user-manual/debugging/inspector/), also from the Launch button's menu, which shows the render passes and draw calls of each frame, and [native GPU profilers](/user-manual/optimization/gpu-profiling/) | | `Debug.DrawLine` and Gizmos | `this.app.drawLine()`, and [`WireRenderer`](/user-manual/graphics/debug-drawing/) for spheres, boxes and other shapes | ## Version Control and Collaboration {#version-control-and-collaboration} diff --git a/docs/user-manual/getting-started/start-with-create-playcanvas.md b/docs/user-manual/getting-started/start-with-create-playcanvas.md index 88263113030..d4dc609ba06 100644 --- a/docs/user-manual/getting-started/start-with-create-playcanvas.md +++ b/docs/user-manual/getting-started/start-with-create-playcanvas.md @@ -85,7 +85,7 @@ To publish an Editor project as a Web Lens instead, see [Snapchat Web Lenses](/u ## Debug with the Inspector -The development server loads the [Inspector](/user-manual/scripting/debugging/inspector/) for the running application. Press the backquote key (`` ` ``) to show or hide it, F9 to pause, and F10 to step one frame. Production builds do not include the Inspector. +The development server loads the [Inspector](/user-manual/debugging/inspector/) for the running application. Press the backquote key (`` ` ``) to show or hide it, F9 to pause, and F10 to step one frame. Production builds do not include the Inspector. ## Skip the Prompts diff --git a/docs/user-manual/optimization/index.md b/docs/user-manual/optimization/index.md index d18da2de357..e3e347a267c 100644 --- a/docs/user-manual/optimization/index.md +++ b/docs/user-manual/optimization/index.md @@ -1,8 +1,26 @@ --- -title: Optimization -description: Why and how to optimize load time, frame rate, CPU, GPU load, and memory in PlayCanvas applications. +title: Debugging and Optimization +description: Tools for finding bugs and performance problems in PlayCanvas applications, and why and how to optimize load time, frame rate, CPU and GPU load, and memory. --- +This section covers the tools for looking inside a running PlayCanvas application, to find out why it does not behave as expected or does not perform as it should, and the ways of making it load and run faster. + +## Which Tool to Use {#which-tool-to-use} + +| To find out | Use | +| ----------- | --- | +| What your code does, and where it goes wrong | [Console Logging](/user-manual/debugging/console-logging/) and the [Browser Dev Tools](/user-manual/debugging/browser-dev-tools/) | +| What the application holds: its entities and components, cameras, assets and GPU resources | The [Inspector](/user-manual/debugging/inspector/) | +| How a frame renders, pass by pass and draw by draw | The Frame graph tab of the [Inspector](/user-manual/debugging/inspector/), and [stepping through a frame](/user-manual/debugging/inspector/#stepping-through-a-frame) | +| What your code computes in the scene, such as bounds, directions or the content of a render target | [Debug Drawing](/user-manual/graphics/debug-drawing/) | +| Whether the application keeps its frame rate as you use it | [MiniStats](/user-manual/optimization/mini-stats/) | +| Which frames are slow, and what holds them back: the CPU, the GPU, scripts or loading | The [Performance tab of the Inspector](/user-manual/optimization/inspector-performance/) | +| How long the application takes to start, and what loads when | The [Performance tab of the Inspector](/user-manual/optimization/inspector-performance/#recording-the-start-of-the-application), or the [Editor Profiler](/user-manual/optimization/profiler/) | +| The statistics of the engine from code, for dashboards and automated comparisons | [Profiling with AppStats](/user-manual/optimization/app-stats/) | +| What the GPU does within a frame, in detail | [GPU Profiling](/user-manual/optimization/gpu-profiling/) with the native GPU tools | + +## Optimization + Optimization is a critical part of developing a PlayCanvas application. It can mean the difference between a great user experience and a terrible one. :::tip @@ -20,17 +38,9 @@ Let's begin by establishing the key goals for optimization and highlight why eac | 🔋 Minimize CPU and GPU load | Just because your app maintains 60 frames per second does not mean your work is done. Reducing processor load preserves battery power and keeps devices running cool. | | 🧠 Minimize memory utilization | Browsers allocate a limited pool of memory to applications. Once this pool is exhausted, the tab will crash and reload. Your users will be upset! | -## Measure Before Optimizing - -Choose a repeatable scene or interaction, record a baseline on the target device, then measure each change under the same conditions. +### Measure Before Optimizing {#measure-before-optimizing} -| Tool | Use it for | -| ---- | ---------- | -| [MiniStats](/user-manual/optimization/mini-stats/) | Watching frame time, CPU/GPU costs and GPU resource memory while interacting with the application. | -| [Profiling with AppStats](/user-manual/optimization/app-stats/) | Reading public statistics from code and collecting reports for dashboards, agents and automated comparisons. | -| [Editor Profiler](/user-manual/optimization/profiler/) | Inspecting the Editor Launch profiler, including asset loading and shader compilation timelines. | -| [GPU Profiling](/user-manual/optimization/gpu-profiling/) | Capturing frames with native GPU tools for detailed rendering investigations. | -| [Inspector](/user-manual/scripting/debugging/inspector/) | Finding where video memory goes, which passes and draws a frame makes, and what each mesh and material uses, in the running application. | +Choose a repeatable scene or interaction, record a baseline on the target device, then measure each change under the same conditions, with the profiling tools in [Which Tool to Use](#which-tool-to-use). The [guidelines](/user-manual/optimization/guidelines/) and the pages after them describe what to change. :::ai Give an AI assistant a performance goal, repeatable scenario and baseline reports from **[AppStats](/user-manual/optimization/app-stats/#collecting-periodic-reports)**. It can combine these with MiniStats or browser evidence and propose one measurable change at a time. Use the **[Editor MCP Server](/user-manual/editor/mcp-server/)** to replay Editor input or follow **[Developing with AI](/user-manual/engine/developing-with-ai/)** for standalone projects. diff --git a/docs/user-manual/optimization/inspector-performance.md b/docs/user-manual/optimization/inspector-performance.md new file mode 100644 index 00000000000..a499562db91 --- /dev/null +++ b/docs/user-manual/optimization/inspector-performance.md @@ -0,0 +1,131 @@ +--- +title: Inspector Performance +description: Record the frames of a running application on the Inspector's Performance tab - frame, CPU, GPU and script times, loading and the start of the application, the app's counters - and step through each frame on its timeline. +--- + +The Performance tab of the [Inspector](/user-manual/debugging/inspector/) records the frames of a running application and charts them over time, to find the frames that are slow and see what held them back. Where [MiniStats](/user-manual/optimization/mini-stats/) shows recent averages while you use the application, the Performance tab keeps every frame of a capture, up to the last 1000, to compare frames and step through them one by one. + +The Performance tab of the Inspector, with a capture charted over time, a frame shown on its timeline and its figures listed below + +## Recording + +Press the record button, a ring around a dot, to record every frame. It shows red while recording, and pressing it again stops. The button beside it clears the capture. + +The charts cover the whole capture along its time: each frame is as wide as it lasted, so slow frames take the room they took, and a pause longer than a second, such as between two recordings, folds to a break mark labelled with its length. From the top: + +| Chart | Shows | +|-------|-------| +| **Frame** | The frame interval. | +| **CPU** | The time of the main thread, by phase: the update of the systems, the physics, the scripts, the animation, the post-update, the render and the Inspector's own time. | +| **GPU** | The GPU time of the frame, with **GPU timings** turned on. | +| **Draw calls** | The draw calls, by kind where the engine counts them. | +| **Scripts** | The time of each script type, with **Script timing** turned on. See [Script Timing](#script-timing). | +| **Counters** | The counters the application keeps in `app.stats.user`. See [Counters](#counters). | +| **Loading** | The milestones of the page and the application, the assets loading and the requests in flight. See [Loading](#loading). | +| **Memory** | The JavaScript heap, the video memory and each kind of it, as lines sharing a scale. | +| **Resources** | The count of textures, render targets, shaders, buffers and, on WebGPU, pipelines. | +| **Events** | A row for each kind of event, marking the frames that had one. See [Events](#events). | + +A dashed line marks the display interval on the Frame, CPU and GPU charts. Hover a chart for the figures of the frame under the pointer, and a mark for what happened. Click the name of a chart or a section to collapse it, and untick a line in the list beside a chart to hide it; the chart then rescales to the others. Drag the divider between the names and the charts to make the names wider. + +To look at part of the capture: + +- Click a frame to show it on the [frame timeline](#the-frame-timeline), with everything recorded for it in the property view below. +- Drag across the charts to select frames together, with their averages, 95th percentiles and largest figures. The timeline then shows their average frame. +- Scroll over the charts to zoom, then drag the scrollbar under them, or drag across them holding Shift, to pan. Double-click to see the whole capture again. +- **‹** and **›** step a frame, **«** shows the first and **»** the newest, following it as frames are recorded. While the panel has focus, the arrow keys step a frame (ten with Shift), Home shows the first and End follows the newest. + +### Events + +| Event | Marks | +|-------|-------| +| **Hitches** | Frames that took over twice as long as the median frame, whatever held them back: the frames the user sees stutter. | +| **Thread blocked** | Frames in which the browser's main thread was busy for 50 milliseconds or more, with the script that ran longest, as Chromium browsers report them. It tells why a frame was slow: a hitch without it was held back by the GPU, the browser or the display, which the hover of the hitch says. | +| **Lightmaps** | Lightmaps the application baked with the lightmapper, for an application with one. | +| **Shaders** | Shaders compiled or created, and render pipelines created. | +| **Heap shrank** | The JavaScript heap shrinking: a garbage collection. | +| **Resources** | Textures, render targets or buffers created or destroyed. | +| **Measures** | Spans the application measures with `performance.measure`. | + +## The Frame Timeline + +The timeline under the charts shows the frame selected along its own time, as a flame chart. + +The timeline of a frame: the update, the scripts by type and the render on the CPU, and the effects with their passes on the GPU + +- The **CPU** line holds the update, the post-update, the Inspector and the render, and the lightmap bakes where they ran. The lines below break them down: the physics step and the animation, the render phases, and with [Script Timing](#script-timing) the scripts of the update and the post-update with a line breaking them down by script type. +- The **GPU** line holds the effects, such as bloom or depth of field, with the passes each runs below it, and the passes of their own. See [GPU Timings](#gpu-timings). +- The **Events** line holds the long tasks of the main thread and the spans measured with `performance.measure`, and the lines below it the milestones, the assets and the requests of the frame. + +Hover a bar for its time, or a line for everything on it. Click a script type to show it on the Scripts tab, a pass or an effect to show it on the Frame graph tab, and an asset to show it on the Assets tab. Scroll over the timeline to zoom into part of the frame, drag the scrollbar under it or drag across it holding Shift to pan, and double-click it to see the whole frame again. Click its title to collapse it. + +The property view below lists everything recorded for the frame: what held it back, the CPU time by phase, the GPU time of each pass, the scripts, the counters, what loaded, the work it submitted, memory and resources, and its events. + +## GPU Timings + +Turn on **GPU timings** to record the time of the GPU. On WebGPU each pass is timed, and the effect of a pass comes from the frame graph, as the pass it runs for; where the frame graph no longer matches the passes timed, every pass goes on the GPU line. Passes of one name in a row share a label, as Downsample ×5, and the frame details list the time of each. WebGL times the frame as a whole. + +## Script Timing + +Turn on **Script timing** to time each script type while recording: the time of its `update`, `postUpdate` and `initialize` calls, without the calls nested in them, and how many times each was called. The CPU chart then shows the scripts apart from the other systems, and the timeline draws them where they ran. + +The **Scripts** chart stacks the ten script types that took the longest, over the frames selected together or else the whole capture, so selecting a spike brings forward the scripts behind it. The others share one band, whose hover lists them. **▾ 10 more** under the list gives ten more types a band of their own. To follow a script whatever its time, pin it: **Pin** beside it in the frame details, or Shift+click it in the list. Alt+click a line of a list to show it alone, and again to show them all. + +Timing a call costs the application about half a microsecond, counted as the Inspector's time. Time spent in event handlers, timers and promises is not counted. On a page that is not cross-origin isolated, the browser's clock steps by a tenth of a millisecond, so the times of small scripts read best over many frames selected together. + +## Loading + +The **Loading** section shares the time of the charts: + +- **Milestones** marks the moments of the page and the application: the page arriving, the DOM being ready, the first paints, the preload, the application starting and its first frame. +- **Assets** draws each asset loading, from asking for it to its resource being ready: the request of its file solid and the processing after it, such as parsing, faint. The color is the kind of asset, with a key in the tooltip of the row's name, and failures are red. +- **Requests** charts how many requests of the page were in flight. + +Hover the section for what was loading, and click an asset to show it on the Assets tab. + +## Recording the Start of the Application {#recording-the-start-of-the-application} + +To record from the first frame the application runs, pass `record: true` to the Inspector, or set the `record` attribute of the `EntityInspector` script. Created before the application runs its first frame, as right after `app.init()`, the Inspector records the start of the application too: + +```javascript +const app = new AppBase(canvas); +app.init(createOptions); + +// recording before the first frame records the start of the application too +const inspector = new Inspector(app, { record: true }); + +app.start(); +``` + +The capture then begins with a **Startup** entry, from the page opening to the first frame, with the requests of the page, its milestones, the assets loaded and the times its main thread was blocked. Its details list how long it took, what loaded, the shader compiles, and the slowest assets with their request and processing apart. It is one of the 1000 entries of the capture, so it makes way for frames like any other. + +The Startup entry: the start of the application on the charts and on its timeline, with its milestones, assets and requests + +From code, set `inspector.recording` to start or stop a capture around a part of the application: + +```javascript +// once the part to look at has run +inspector.recording = false; +``` + +## Counters + +The **Counters** section charts the counters the application keeps in [`app.stats.user`](https://api.playcanvas.com/engine/classes/AppStats.html#user), as each frame ended: a line each, with a scale of its own, as their units are the application's. The frame details list their values, and the frames selected together their averages, 95th percentiles and largest. See [Profiling with AppStats](/user-manual/optimization/app-stats/) for the counters themselves: + +```javascript +// counted afresh each frame +app.on('frameupdate', () => app.stats.user.set('enemies', 0)); + +// wherever the application counts them +app.stats.user.set('enemies', app.stats.user.get('enemies') + 1); +``` + +## Engine Builds + +The release build of the engine times the update and the render as a whole. The profiler and debug builds add the phases of the render, the batcher's updating and creating of batches among them, the breakdown of the draw calls, the shader compiles and the lightmap bakes. + +The Inspector runs inside the application's update, so its own time is shown apart, as Inspector. Turn off **Inspector time** to leave it out of the CPU chart, which then scales to the application's own time. + +## Copying the Figures + +Right-click the name of the tab to copy the whole capture, every frame with all it recorded, or the name of a chart or a section, or a line of its list, to copy that series a row per frame, as JSON or as CSV for a spreadsheet. Both cover the frames selected together when there are any. Right-click a frame in the charts to copy it, inside the frames selected together to copy their figures, and the timeline to copy its bars. diff --git a/docs/user-manual/scripting/index.md b/docs/user-manual/scripting/index.md index 579ab89a266..90210d42cba 100644 --- a/docs/user-manual/scripting/index.md +++ b/docs/user-manual/scripting/index.md @@ -68,5 +68,5 @@ Rotate.prototype.update = function(dt) { - [Script Attributes](./script-attributes/index.md) — Exposing configurable properties. - [Engine API](./engine-api.md) — Key classes and patterns. - [Events](./events.md) — Communication between scripts. -- [Debugging](./debugging/index.md) — Tools and techniques for troubleshooting. +- [Debugging](/user-manual/debugging/) — Tools and techniques for troubleshooting. - [Migration Guide](./migration-guide.md) — Upgrading from classic to ESM scripts. diff --git a/docusaurus.config.js b/docusaurus.config.js index 3480685fb4b..44e1892f8fd 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -68,6 +68,11 @@ const config = { plugins: [ [ '@docusaurus/plugin-client-redirects', { redirects: [ + // Debugging moved out of Scripting into Debugging and Optimization + { from: ['/user-manual/scripting/debugging/'], to: '/user-manual/debugging/' }, + { from: ['/user-manual/scripting/debugging/console-logging/'], to: '/user-manual/debugging/console-logging/' }, + { from: ['/user-manual/scripting/debugging/browser-dev-tools/'], to: '/user-manual/debugging/browser-dev-tools/' }, + { from: ['/user-manual/scripting/debugging/inspector/'], to: '/user-manual/debugging/inspector/' }, { from: ['/api', '/en/api'], to: 'https://api.playcanvas.com' }, // Retired Facebook docs (the Facebook Canvas web games platform was discontinued) { from: ['/tutorials/facebook-api/'], to: '/tutorials/' }, diff --git a/i18n/ja/docusaurus-plugin-content-docs/current.json b/i18n/ja/docusaurus-plugin-content-docs/current.json index 9e0454daee1..03acb60a036 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current.json +++ b/i18n/ja/docusaurus-plugin-content-docs/current.json @@ -19,6 +19,14 @@ "message": "2D", "description": "The label for category 2D in sidebar userManualSidebar" }, + "sidebar.userManualSidebar.category.Debugging and Optimization": { + "message": "デバッグず最適化", + "description": "The label for category Debugging and Optimization in sidebar userManualSidebar" + }, + "sidebar.userManualSidebar.category.Profiling": { + "message": "プロファむリング", + "description": "The label for category Profiling in sidebar userManualSidebar" + }, "sidebar.userManualSidebar.category.Optimization": { "message": "最適化", "description": "The label for category Optimization in sidebar userManualSidebar" @@ -199,6 +207,10 @@ "message": "スクリプト属性", "description": "The label for category Script Attributes in sidebar userManualSidebar" }, + "sidebar.userManualSidebar.doc.Debugging": { + "message": "デバッグ", + "description": "The label for the doc item Debugging in sidebar userManualSidebar, linking to the doc user-manual/debugging/index" + }, "sidebar.userManualSidebar.category.Debugging": { "message": "デバッグ", "description": "The label for category Debugging in sidebar userManualSidebar" diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/browser-dev-tools.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/browser-dev-tools.md similarity index 96% rename from i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/browser-dev-tools.md rename to i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/browser-dev-tools.md index e24e8898c83..688089084ea 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/browser-dev-tools.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/browser-dev-tools.md @@ -11,11 +11,11 @@ Chrome、Firefoxや他のブラりザでは、ブラりザに盎接組み蟌た スクリプトをデバッグするためには、Developer Tools (Chrome)でSourcesタブを遞択したす。Sourcesペむンの巊䞊隅にあるアむコンをクリックしお 'navigator' を開きたす。以䞋のようなものが衚瀺されるはずです -![Debugger](/img/user-manual/scripting/debugging/chrome-debugger.png) +![Debugger](/img/user-manual/debugging/chrome-debugger.png) Firefoxでは次のようになりたす -![Firefox](/img/user-manual/scripting/debugging/firefox-debugger.png) +![Firefox](/img/user-manual/debugging/firefox-debugger.png) ナビゲヌタには、自身で曞いたPlayCanvasスクリプトを含む、珟圚アクティブなタブで実行しおいる党おのスクリプトがリストされたす。ナビゲヌタヌからスクリプトを探し、遞択するず゜ヌスコヌドが開きたす。これで、ブレむクポむントを蚭定しおデバッグが行えたす。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/console-logging.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/console-logging.md similarity index 100% rename from i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/console-logging.md rename to i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/console-logging.md diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/index.md new file mode 100644 index 00000000000..0a852c688a2 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/index.md @@ -0,0 +1,32 @@ +--- +title: デバッグ +description: ロギング、ブラりザの開発者ツヌル、Inspector、デバッグ描画を䜿っお PlayCanvas アプリケヌションのバグを芋぀け修正するツヌルず手法です。 +--- + +デバッグは、PlayCanvasアプリケヌションの問題を、スクリプトだけでなくレンダリングやロヌドされるものも含めお特定し、修正するために䞍可欠です。期埅通りに動䜜しない堎合、これらのツヌルずテクニックは問題を迅速に芋぀けお解決するのに圹立ちたす。動䜜が遅い理由を調べるには、[䜿うツヌル](/user-manual/optimization/#which-tool-to-use)を参照しおください。 + +## デバッグテクニック + +### コン゜ヌルロギング + +コヌドが䜕をしおいるかを理解する最も手軜な方法です。実行フロヌを远跡し、倉数の倀を怜査するために`console.log()`ステヌトメントを远加したす。 + +**[コン゜ヌルロギングを孊ぶ →](./console-logging.md)** + +### ブラりザ開発者ツヌル + +ブレヌクポむント、ステップスルヌデバッグ、パフォヌマンスプロファむリングを䜿甚しお、実行䞭のコヌドを詳现に怜査したす。 + +**[ブラりザ開発者ツヌルを孊ぶ →](./browser-dev-tools.md)** + +### Inspector + +実行䞭のアプリケヌションの内郚を確認したす。゚ンティティずコンポヌネント、カメラ、アセット、GPUリ゜ヌス、各フレヌムのパス、そしおパスの描画を1぀ず぀確認できたす。 + +**[Inspectorを孊ぶ →](./inspector.md)** + +### デバッグ描画 + +シヌンの䞊に線、圢状、テクスチャを描画しお、バりンディングや方向、レンダヌタヌゲットの内容やシヌンの深床など、コヌドが蚈算するものを確認したす。 + +**[デバッグ描画を孊ぶ →](/user-manual/graphics/debug-drawing/)** diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/inspector.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/inspector.md similarity index 90% rename from i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/inspector.md rename to i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/inspector.md index db2b8b4d68b..882b9ddccfa 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/inspector.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/debugging/inspector.md @@ -1,11 +1,11 @@ --- title: Inspector -description: 実行䞭の PlayCanvas アプリケヌションをデバッグパネルで調べたす。゚ンティティ、カメラ、アセット、フレヌムグラフ、GPU リ゜ヌス、Script、シェヌダヌを確認し、フレヌムの描画を1぀ず぀進められたす。 +description: 実行䞭の PlayCanvas アプリケヌションをデバッグパネルで調べたす。゚ンティティ、カメラ、アセット、フレヌムグラフ、GPU リ゜ヌス、Script、シェヌダヌを確認し、フレヌムの描画を1぀ず぀進め、パフォヌマンスを蚘録できたす。 --- Inspectorは、実行䞭のPlayCanvasアプリケヌション甚のデバッグパネルです。キャンバスの暪にドッキングし、アプリケヌションのシヌン、GPUリ゜ヌス、描画されたフレヌムを珟圚の状態で衚瀺したす。遞択したもののプロパティは、䞋のビュヌでリアルタむムに曎新されたす。 -実行䞭のアプリケヌションの暪にドッキングしたInspectorパネル。ピラルキヌで゚ンティティを遞択しおいたす +実行䞭のアプリケヌションの暪にドッキングしたInspectorパネル。ピラルキヌで゚ンティティを遞択しおいたす 次のような疑問を解決するのに圹立ちたす。 @@ -13,6 +13,7 @@ Inspectorは、実行䞭のPlayCanvasアプリケヌション甚のデバッグ - メッシュはどのマテリアルずシェヌダヌで描画され、どのテクスチャを䜿っおいるか。 - フレヌムは䜕を、どのパスで、どの順序で描画しおいるか。 - ビデオメモリはどこで䜿われおいるか。 +- どのフレヌムが遅く、䜕がそれを遅らせおいるか。 Inspectorはアプリケヌションを読み取るだけです。倉曎を加えるのは、ナヌザヌが指瀺した堎合に限られたす。゚ンティティのオン・オフ、アプリケヌションの䞀時停止ずコマ送り、そしお衚瀺だけに関わる䞊曞きレンダヌモヌド、ワむダヌフレヌム、飛行たたはオヌビットするカメラです。これらはInspectorを閉じるず元に戻りたす。 @@ -56,6 +57,7 @@ app.root.addChild(entity); | `toggleKey` | `` 'Backquote' `` | パネルの衚瀺・非衚瀺を切り替えるキヌ。 | | `pauseKey` | `'F9'` | アプリケヌションを䞀時停止・再開するキヌ。 | | `stepKey` | `'F10'` | 䞀時停止䞭に1フレヌム進めるキヌ。 | +| `record` | `false` | Performance タブでフレヌムの蚘録を開始するかどうか。アプリケヌションの最初のフレヌムより前に䜜成するず、Inspector はその起動も蚘録したす。[アプリケヌションの起動の蚘録](/user-manual/optimization/inspector-performance/#recording-the-start-of-the-application)を参照しおください。 | | `storageKey` | `'pc-inspector'` | アクティブなタブやパネルの幅など、パネルの蚭定を保存するロヌカルストレヌゞのキヌ。`null`の堎合は䜕も保存したせん。 | ## ツヌルバヌ {#the-toolbar} @@ -82,6 +84,7 @@ Escキヌで、ピック、飛行、オヌビットを終了したす。 | **Cameras** | 描画順のカメラず、それぞれの描画先。レンダヌモヌドを䜿うず、最終的な画像の代わりにアルベド、ワヌルド法線、ラむティングなどのシヌンのマテリアル入力を、1぀のカメラたたはすべおのカメラで衚瀺できたす。シヌンをワむダヌフレヌムで描画するこずもできたす。 | | **Assets** | レゞストリ内のすべおのアセットず、そのファむル、読み蟌み状態、䜿甚箇所。 | | **Frame graph** | 盎前のフレヌムを描画したパスを順に衚瀺し、それぞれのレむダヌ、描画、レンダヌタヌゲットを瀺したす。**GPU timings**はデバむスが蚈枬できる堎合に各パスのGPU時間を衚瀺し、**Freeze**はアプリケヌションの実行䞭も珟圚のフレヌムを衚瀺し続け、**Preview**は遞択したパスのレンダヌタヌゲットをビュヌの䞊に描画したす。 | +| **Performance** | アプリケヌションのフレヌムを蚘録し、フレヌム、CPU、GPU、スクリプトの時間、ロヌドされたもの、メモリ、リ゜ヌスを時間に沿っおチャヌト衚瀺し、各フレヌムを独自のタむムラむンで衚瀺したす。[Inspector のパフォヌマンス](/user-manual/optimization/inspector-performance/)を参照しおください。 | | **Render targets** | デバむス䞊のレンダヌタヌゲットず、そこに描画したパス、遞択したアタッチメントのラむブプレビュヌ。 | | **Textures** | デバむス䞊のテクスチャを倧きい順に衚瀺し、ラむブプレビュヌず衚瀺するチャンネルの遞択を提䟛したす。 | | **Meshes** | アプリケヌションのメッシュを倧きい順に衚瀺し、そのゞオメトリず䜿甚箇所を瀺したす。 | @@ -91,7 +94,7 @@ Escキヌで、ピック、飛行、オヌビットを終了したす。 | **Shaders** | コンパむル枈みのシェヌダヌずその゜ヌス。 | | **Physics** | 物理ワヌルドの剛䜓ずゞョむント、そしおワヌルドをシヌンの䞊に描画するオプション。 | -フォワヌドパスを遞択し、そのレンダヌタヌゲットをビュヌの䞊にプレビュヌしおいるFrame graphタブ +フォワヌドパスを遞択し、そのレンダヌタヌゲットをビュヌの䞊にプレビュヌしおいるFrame graphタブ ## フレヌムのステップ実行 {#stepping-through-a-frame} @@ -102,7 +105,7 @@ Frame graphタブでは、フレヌムをドロヌコヌル1぀ず぀描画で 3. 䞊䞋の矢印キヌで、描画を1぀ず぀戻ったり進めたりしたす。プロパティビュヌには描画されたメッシュむンスタンスが䞀芧衚瀺され、珟圚のものが匷調衚瀺されたす。ビュヌではその茪郭が衚瀺され、ステヌタスバヌには*draw 8 of 12 · World opaque*のようにその番号が衚瀺されたす。項目を展開するず、メッシュやマテリアルなどの詳现を確認できたす。 4. **Debug frame**をオフにするず、再びフレヌム党䜓が描画されたす。 -Worldレむダヌの描画を1぀ず぀進めおいる様子 +Worldレむダヌの描画を1぀ず぀進めおいる様子 :::note 描画のステップ実行にぱンゞンのデバッグビルドが必芁で、他のビルドではこのオプションは無効になりたす。Viteなどのバンドラヌは、開発時に`playcanvas`パッケヌゞの`development`゚クスポヌト条件によっおデバッグビルドを遞択したす。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/migrating-from-unity.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/migrating-from-unity.md index 926ca30ee88..7d4710f755f 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/migrating-from-unity.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/migrating-from-unity.md @@ -52,7 +52,7 @@ Unityはゲヌムを゚ディタヌの䞭で再生したす。PlayCanvasは新 スクリプトが゚ディタヌのビュヌポヌトで実行されるこずはないため、Unityの`[ExecuteInEditMode]`に盞圓するものはありたせん。スクリプトが䜜成したり倉曎したりするものは、起動したアプリにしか珟れたせん。 -Launchボタンのメニュヌには、テスト甚のオプションがありたす。グラフィックスAPIを遞んだり、[プロファむラヌ](/user-manual/optimization/profiler/)、[MiniStats](/user-manual/optimization/mini-stats/)、[Inspector](/user-manual/scripting/debugging/inspector/)を開いたりできたす。**Debug** にチェックを入れるず、゚ンゞンの譊告ず゚ラヌがコン゜ヌルに蚘録されたす。 +Launchボタンのメニュヌには、テスト甚のオプションがありたす。グラフィックスAPIを遞んだり、[プロファむラヌ](/user-manual/optimization/profiler/)、[MiniStats](/user-manual/optimization/mini-stats/)、[Inspector](/user-manual/debugging/inspector/)を開いたりできたす。**Debug** にチェックを入れるず、゚ンゞンの譊告ず゚ラヌがコン゜ヌルに蚘録されたす。 ### ビュヌポヌトの操䜜 {#navigating-the-viewport} @@ -641,11 +641,11 @@ Unityはプラットフォヌムごずにプレむダヌをビルドしたす。 | Unity | PlayCanvas | | --- | --- | -| Consoleりィンドり | 開発者ツヌルの **Console** タブ。[コン゜ヌルロギング](/user-manual/scripting/debugging/console-logging/)を参照しおください。 | -| Visual StudioやRiderのアタッチ | 開発者ツヌルの **Sources** タブで蚭定するブレヌクポむント。[ブラりザ開発ツヌル](/user-manual/scripting/debugging/browser-dev-tools/)を参照しおください。 | +| Consoleりィンドり | 開発者ツヌルの **Console** タブ。[コン゜ヌルロギング](/user-manual/debugging/console-logging/)を参照しおください。 | +| Visual StudioやRiderのアタッチ | 開発者ツヌルの **Sources** タブで蚭定するブレヌクポむント。[ブラりザ開発ツヌル](/user-manual/debugging/browser-dev-tools/)を参照しおください。 | | `Debug.Break()` | 開発者ツヌルを開いおいるずきにアプリを䞀時停止する`debugger;`文 | | Profiler | Launchボタンのメニュヌから䜿う[プロファむラヌ](/user-manual/optimization/profiler/)ず[MiniStats](/user-manual/optimization/mini-stats/)、および開発者ツヌルの **Performance** タブ | -| Frame Debugger | 同じくLaunchボタンのメニュヌから䜿え、各フレヌムのレンダヌパスずドロヌコヌルを衚瀺する[Inspector](/user-manual/scripting/debugging/inspector/)ず、[ネむティブのGPUプロファむラヌ](/user-manual/optimization/gpu-profiling/) | +| Frame Debugger | 同じくLaunchボタンのメニュヌから䜿え、各フレヌムのレンダヌパスずドロヌコヌルを衚瀺する[Inspector](/user-manual/debugging/inspector/)ず、[ネむティブのGPUプロファむラヌ](/user-manual/optimization/gpu-profiling/) | | `Debug.DrawLine`ずGizmos | `this.app.drawLine()`ず、球やボックスなどの圢状を描く[`WireRenderer`](/user-manual/graphics/debug-drawing/) | ## バヌゞョン管理ずコラボレヌション {#version-control-and-collaboration} diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/start-with-create-playcanvas.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/start-with-create-playcanvas.md index 5143a33b089..dae629507ee 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/start-with-create-playcanvas.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/getting-started/start-with-create-playcanvas.md @@ -85,7 +85,7 @@ EditorのプロゞェクトをWeb Lensずしお公開する堎合は、[Snapchat ## Inspectorでデバッグする -開発サヌバヌは、実行䞭のアプリケヌション甚に[Inspector](/user-manual/scripting/debugging/inspector/)を読み蟌みたす。バッククォヌトキヌ`` ` ``で衚瀺ず非衚瀺を切り替え、F9で䞀時停止し、F10で1フレヌムず぀進めたす。Inspectorはプロダクションビルドには含たれたせん。 +開発サヌバヌは、実行䞭のアプリケヌション甚に[Inspector](/user-manual/debugging/inspector/)を読み蟌みたす。バッククォヌトキヌ`` ` ``で衚瀺ず非衚瀺を切り替え、F9で䞀時停止し、F10で1フレヌムず぀進めたす。Inspectorはプロダクションビルドには含たれたせん。 ## プロンプトを省略する diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/index.md index b5189bf6e9c..e741d3397c4 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/index.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/index.md @@ -1,8 +1,26 @@ --- -title: 最適化 -description: PlayCanvas アプリケヌションでロヌド時間、フレヌムレヌト、CPU、GPU 負荷、メモリを最適化する理由ず方法です。 +title: デバッグず最適化 +description: PlayCanvas アプリケヌションのバグやパフォヌマンスの問題を芋぀けるツヌルず、ロヌド時間、フレヌムレヌト、CPU ず GPU の負荷、メモリを最適化する理由ず方法です。 --- +このセクションでは、実行䞭の PlayCanvas アプリケヌションの内郚を調べ、期埅どおりに動䜜しない理由や、期埅どおりのパフォヌマンスが出ない理由を芋぀けるツヌルず、アプリケヌションのロヌドず実行を速くする方法を説明したす。 + +## 䜿うツヌル {#which-tool-to-use} + +| 調べたいこず | 䜿うもの | +| ------------ | -------- | +| コヌドが䜕をしおいお、どこで問題が起きおいるか | [コン゜ヌルロギング](/user-manual/debugging/console-logging/)ず[ブラりザ開発者ツヌル](/user-manual/debugging/browser-dev-tools/) | +| アプリケヌションの䞭身゚ンティティずコンポヌネント、カメラ、アセット、GPU リ゜ヌス | [Inspector](/user-manual/debugging/inspector/) | +| フレヌムがパスごず、描画ごずにどうレンダリングされるか | [Inspector](/user-manual/debugging/inspector/) の Frame graph タブず、[フレヌムのステップ実行](/user-manual/debugging/inspector/#stepping-through-a-frame) | +| コヌドがシヌン内で蚈算するものバりンディング、方向、レンダヌタヌゲットの内容など | [デバッグ描画](/user-manual/graphics/debug-drawing/) | +| 操䜜䞭にアプリケヌションがフレヌムレヌトを保おおいるか | [MiniStats](/user-manual/optimization/mini-stats/) | +| どのフレヌムが遅く、䜕がそれを遅らせおいるかCPU、GPU、スクリプト、ロヌド | [Inspector の Performance タブ](/user-manual/optimization/inspector-performance/) | +| アプリケヌションの起動にかかる時間ず、䜕がい぀ロヌドされるか | [Inspector の Performance タブ](/user-manual/optimization/inspector-performance/#recording-the-start-of-the-application)、たたは [Editor Profiler](/user-manual/optimization/profiler/) | +| ダッシュボヌドや自動比范のための、コヌドからの゚ンゞンの統蚈 | [AppStatsによるプロファむリング](/user-manual/optimization/app-stats/) | +| フレヌム内で GPU が行う凊理の詳现 | ネむティブ GPU ツヌルによる [GPUプロファむリング](/user-manual/optimization/gpu-profiling/) | + +## 最適化 {#optimization} + 最適化は、PlayCanvasアプリケヌション開発の重芁な郚分です。それは、優れたナヌザヌ゚クスペリ゚ンスずひどいナヌザヌ゚クスペリ゚ンスの分かれ目ずなるこずがありたす。 :::tip @@ -20,17 +38,9 @@ description: PlayCanvas アプリケヌションでロヌド時間、フレヌ | 🔋 CPUずGPUの負荷の最小化 | アプリが1秒間に60フレヌムを維持しおいるからずいっお、䜜業が完了したわけではありたせん。プロセッサヌの負荷を枛らすこずでバッテリヌ電力を節玄し、デバむスを䜎枩に保ちたす。 | | 🧠 メモリ䜿甚量の最小化 | ブラりザはアプリケヌションに割り圓おるメモリプヌルを制限しおいたす。このプヌルが枯枇するず、タブがクラッシュしお再ロヌドされたす。ナヌザヌは䞍満に感じるでしょう | -## 最適化の前に枬定する {#measure-before-optimizing} - -再珟可胜なシヌンや操䜜を遞び、察象デバむスでベヌスラむンを蚘録しおから、同じ条件で各倉曎を枬定したす。 +### 最適化の前に枬定する {#measure-before-optimizing} -| ツヌル | 甹途 | -| ------ | ---- | -| [MiniStats](/user-manual/optimization/mini-stats/) | アプリケヌションを操䜜しながら、フレヌム時間、CPU/GPUコスト、GPUリ゜ヌスメモリを芳察したす。 | -| [AppStatsによるプロファむリング](/user-manual/optimization/app-stats/) | コヌドから公開統蚈を読み取り、ダッシュボヌド、゚ヌゞェント、自動比范向けのレポヌトを収集したす。 | -| [Editor Profiler](/user-manual/optimization/profiler/) | アセットの読み蟌みやシェヌダヌのコンパむルのタむムラむンなど、゚ディタヌのLaunchプロファむラヌを確認したす。 | -| [GPUプロファむリング](/user-manual/optimization/gpu-profiling/) | ネむティブGPUツヌルでフレヌムをキャプチャし、レンダリングを詳しく調査したす。 | -| [Inspector](/user-manual/scripting/debugging/inspector/) | 実行䞭のアプリケヌションで、ビデオメモリの䜿われ方、フレヌムのパスず描画、各メッシュずマテリアルが䜿うものを調べたす。 | +再珟可胜なシヌンや操䜜を遞び、察象デバむスでベヌスラむンを蚘録しおから、[䜿うツヌル](#which-tool-to-use)のプロファむリングツヌルを䜿い、同じ条件で各倉曎を枬定したす。䜕を倉曎するかは、[ガむドラむン](/user-manual/optimization/guidelines/)ずそれに続くペヌゞで説明しおいたす。 :::ai AIアシスタントに目暙、再珟手順、[**AppStats**](/user-manual/optimization/app-stats/#collecting-periodic-reports)のベヌスラむンレポヌトを枡すず、MiniStatsやブラりザヌの結果ず組み合わせ、枬定可胜な倉曎を1぀ず぀提案できたす。Editorでは[**Editor MCP Server**](/user-manual/editor/mcp-server/)、スタンドアロンでは[**AIを掻甚した開発**](/user-manual/engine/developing-with-ai/)を䜿甚したす。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/inspector-performance.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/inspector-performance.md new file mode 100644 index 00000000000..c14649ecdd0 --- /dev/null +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/optimization/inspector-performance.md @@ -0,0 +1,131 @@ +--- +title: Inspector のパフォヌマンス +description: Inspector の Performance タブで、実行䞭のアプリケヌションのフレヌムを蚘録したす。フレヌム、CPU、GPU、スクリプトの時間、ロヌドずアプリケヌションの起動、アプリのカりンタヌを確認し、各フレヌムをタむムラむンで1぀ず぀確認できたす。 +--- + +[Inspector](/user-manual/debugging/inspector/)の Performance タブは、実行䞭のアプリケヌションのフレヌムを蚘録しお時間に沿っおチャヌト衚瀺し、遅いフレヌムを芋぀けお、䜕がそれを遅らせたのかを確認できたす。[MiniStats](/user-manual/optimization/mini-stats/)がアプリケヌションを䜿っおいる間の最近の平均を衚瀺するのに察し、Performance タブはキャプチャのすべおのフレヌムを最新の1000フレヌムたで保持し、フレヌムを比范したり1぀ず぀確認したりできたす。 + +Inspector の Performance タブ。キャプチャが時間に沿っおチャヌト衚瀺され、フレヌムがそのタむムラむンに衚瀺され、その数倀が䞋に䞀芧衚瀺されおいたす + +## 蚘録 {#recording} + +蚘録ボタン点を囲むリングを抌すず、すべおのフレヌムを蚘録したす。蚘録䞭は赀く衚瀺され、もう䞀床抌すず停止したす。その隣のボタンはキャプチャをクリアしたす。 + +チャヌトはキャプチャ党䜓を時間に沿っお衚瀺したす。各フレヌムはかかった時間の分の幅を持぀ため、遅いフレヌムはそれだけの堎所を占めたす。2回の蚘録の間のように1秒より長い間隔は、その長さを瀺す区切りマヌクに折りたたたれたす。䞊から順に次のずおりです。 + +| チャヌト | 衚瀺内容 | +|-------|-------| +| **Frame** | フレヌム間隔。 | +| **CPU** | メむンスレッドの時間をフェヌズ別に衚瀺したす。システムの曎新、物理、スクリプト、アニメヌション、ポストアップデヌト、レンダヌ、Inspector 自身の時間です。 | +| **GPU** | **GPU timings** をオンにしたずきのフレヌムの GPU 時間。 | +| **Draw calls** | ドロヌコヌル。゚ンゞンが皮類別に数える堎合は皮類別に衚瀺したす。 | +| **Scripts** | **Script timing** をオンにしたずきの、各スクリプトタむプの時間。[スクリプトの蚈枬](#script-timing)を参照しおください。 | +| **Counters** | アプリケヌションが `app.stats.user` に保持するカりンタヌ。[カりンタヌ](#counters)を参照しおください。 | +| **Loading** | ペヌゞずアプリケヌションのマむルストヌン、ロヌド䞭のアセット、凊理䞭のリク゚スト。[ロヌド](#loading)を参照しおください。 | +| **Memory** | JavaScript ヒヌプ、ビデオメモリずその皮類別の内蚳を、スケヌルを共有する線で衚瀺したす。 | +| **Resources** | テクスチャ、レンダヌタヌゲット、シェヌダヌ、バッファ、WebGPU ではパむプラむンの数。 | +| **Events** | むベントの皮類ごずの行で、そのむベントがあったフレヌムを瀺したす。[むベント](#events)を参照しおください。 | + +Frame、CPU、GPU のチャヌトでは、砎線がディスプレむの間隔を瀺したす。チャヌトにカヌ゜ルを合わせるずポむンタヌの䞋のフレヌムの数倀が、マヌクに合わせるず䜕が起きたかが衚瀺されたす。チャヌトやセクションの名前をクリックするず折りたたたれ、チャヌトの暪のリストで線のチェックを倖すず非衚瀺になり、チャヌトは残りの線に合わせおスケヌルし盎したす。名前ずチャヌトの間の区切り線をドラッグするず、名前の列を広げられたす。 + +キャプチャの䞀郚を芋るには、次のようにしたす。 + +- フレヌムをクリックするず、そのフレヌムが[フレヌムのタむムラむン](#the-frame-timeline)に衚瀺され、蚘録されたすべおの内容が䞋のプロパティビュヌに衚瀺されたす。 +- チャヌトの䞊をドラッグするず、耇数のフレヌムをたずめお遞択し、その平均、95パヌセンタむル、最倧倀を確認できたす。タむムラむンにはそれらの平均フレヌムが衚瀺されたす。 +- チャヌトの䞊でスクロヌルするずズヌムし、䞋のスクロヌルバヌをドラッグするか、Shift を抌しながらチャヌトの䞊をドラッグするずパンしたす。ダブルクリックするずキャプチャ党䜓の衚瀺に戻りたす。 +- **‹** ず **›** で1フレヌムず぀移動し、**«** で最初のフレヌムを、**»** で最新のフレヌムを衚瀺し、蚘録に合わせお远埓したす。パネルにフォヌカスがある間は、矢印キヌで1フレヌムず぀Shift で10フレヌムず぀移動し、Home で最初のフレヌムを衚瀺し、End で最新のフレヌムに远埓したす。 + +### むベント {#events} + +| むベント | 瀺すもの | +|-------|-------| +| **Hitches** | 䜕が原因であれ、䞭倮倀のフレヌムの2倍以䞊の時間がかかったフレヌム。ナヌザヌにカク぀きずしお芋えるフレヌムです。 | +| **Thread blocked** | Chromium 系のブラりザが報告する、ブラりザのメむンスレッドが50ミリ秒以䞊ビゞヌだったフレヌムず、最も長く実行されたスクリプト。フレヌムが遅くなった理由を瀺したす。これのないヒッチは GPU、ブラりザ、ディスプレむによっお遅れたもので、ヒッチのホバヌ衚瀺にそのこずが瀺されたす。 | +| **Lightmaps** | ラむトマッパヌを持぀アプリケヌションで、ラむトマッパヌがベむクしたラむトマップ。 | +| **Shaders** | コンパむルたたは䜜成されたシェヌダヌず、䜜成されたレンダヌパむプラむン。 | +| **Heap shrank** | JavaScript ヒヌプの瞮小、぀たりガベヌゞコレクション。 | +| **Resources** | 䜜成たたは砎棄されたテクスチャ、レンダヌタヌゲット、バッファ。 | +| **Measures** | アプリケヌションが `performance.measure` で蚈枬した区間。 | + +## フレヌムのタむムラむン {#the-frame-timeline} + +チャヌトの䞋のタむムラむンは、遞択したフレヌムをその時間に沿っおフレむムチャヌトflame chartずしお衚瀺したす。 + +フレヌムのタむムラむン。CPU にはアップデヌト、タむプ別のスクリプト、レンダヌが、GPU にぱフェクトずそのパスが衚瀺されおいたす + +- **CPU** の行には、アップデヌト、ポストアップデヌト、Inspector、レンダヌず、実行された䜍眮にラむトマップのベむクが衚瀺されたす。その䞋の行はそれらを现かく分けお衚瀺したす。物理のステップずアニメヌション、レンダヌのフェヌズ、そしお[スクリプトの蚈枬](#script-timing)をオンにした堎合はアップデヌトずポストアップデヌトのスクリプトず、それをスクリプトタむプ別に分けた行です。 +- **GPU** の行には、ブルヌムや被写界深床などの゚フェクトず、その䞋に各゚フェクトが実行するパス、そしお゚フェクトに属さないパスが衚瀺されたす。[GPU の蚈枬](#gpu-timings)を参照しおください。 +- **Events** の行には、メむンスレッドの長いタスクず `performance.measure` で蚈枬された区間が衚瀺され、その䞋の行にはフレヌムのマむルストヌン、アセット、リク゚ストが衚瀺されたす。 + +バヌにカヌ゜ルを合わせるずその時間が、行に合わせるずその行のすべおの内容が衚瀺されたす。スクリプトタむプをクリックするず Scripts タブに、パスや゚フェクトをクリックするず Frame graph タブに、アセットをクリックするず Assets タブに衚瀺されたす。タむムラむンの䞊でスクロヌルするずフレヌムの䞀郚にズヌムし、䞋のスクロヌルバヌをドラッグするか、Shift を抌しながらドラッグするずパンし、ダブルクリックするずフレヌム党䜓の衚瀺に戻りたす。タむトルをクリックするず折りたたたれたす。 + +䞋のプロパティビュヌには、そのフレヌムに぀いお蚘録されたすべおの内容が䞀芧衚瀺されたす。䜕がフレヌムを遅らせたか、フェヌズ別の CPU 時間、各パスの GPU 時間、スクリプト、カりンタヌ、ロヌドされたもの、送信した凊理、メモリずリ゜ヌス、むベントです。 + +## GPU の蚈枬 {#gpu-timings} + +**GPU timings** をオンにするず、GPU の時間を蚘録したす。WebGPU では各パスが蚈枬され、パスの゚フェクトはフレヌムグラフから、そのパスを実行するパスずしお求められたす。フレヌムグラフが蚈枬したパスず䞀臎しなくなった堎合は、すべおのパスが GPU の行に衚瀺されたす。同じ名前のパスが連続する堎合は Downsample ×5 のように1぀のラベルにたずめられ、フレヌムの詳现にはそれぞれの時間が䞀芧衚瀺されたす。WebGL ではフレヌム党䜓を1぀ずしお蚈枬したす。 + +## スクリプトの蚈枬 {#script-timing} + +**Script timing** をオンにするず、蚘録䞭に各スクリプトタむプを蚈枬したす。その `update`、`postUpdate`、`initialize` の呌び出しの時間を、その䞭で呌ばれた呌び出しを陀いお蚈枬し、それぞれが䜕回呌ばれたかも蚘録したす。CPU チャヌトではスクリプトが他のシステムず分けお衚瀺され、タむムラむンではスクリプトが実行された䜍眮に描画されたす。 + +**Scripts** チャヌトは、たずめお遞択したフレヌム、たたは遞択がなければキャプチャ党䜓で最も時間のかかった10個のスクリプトタむプを積み䞊げお衚瀺するため、スパむクを遞択するずその原因のスクリプトが前面に出おきたす。残りは1぀の垯にたずめられ、そのホバヌ衚瀺に䞀芧が衚瀺されたす。リストの䞋の **▾ 10 more** で、さらに10個のタむプに独自の垯を割り圓おたす。時間に関係なくスクリプトを远い続けるには、フレヌムの詳现の暪にある **Pin** を抌すか、リストで Shift+クリックしおピン留めしたす。リストの行を Alt+クリックするずその行だけを衚瀺し、もう䞀床 Alt+クリックするずすべおを衚瀺したす。 + +呌び出しの蚈枬には、Inspector の時間ずしお数えられる玄0.5マむクロ秒のコストがかかりたす。むベントハンドラヌ、タむマヌ、Promise で費やされた時間は数えられたせん。クロスオリゞン分離されおいないペヌゞでは、ブラりザのクロックが0.1ミリ秒刻みになるため、小さなスクリプトの時間は倚くのフレヌムをたずめお遞択したほうが正確に読み取れたす。 + +## ロヌド {#loading} + +**Loading** セクションは、チャヌトず同じ時間軞を共有したす。 + +- **Milestones** は、ペヌゞずアプリケヌションの節目を瀺したす。ペヌゞの到着、DOM の準備完了、最初のペむント、プリロヌド、アプリケヌションの開始ず最初のフレヌムです。 +- **Assets** は、各アセットのロヌドを、芁求しおからそのリ゜ヌスの準備ができるたで衚瀺したす。ファむルのリク゚ストは濃く、パヌスなどその埌の凊理は薄く衚瀺されたす。色はアセットの皮類を瀺し、行の名前のツヌルチップに凡䟋がありたす。倱敗したものは赀で衚瀺されたす。 +- **Requests** は、ペヌゞのリク゚ストがいく぀凊理䞭だったかをチャヌト衚瀺したす。 + +セクションにカヌ゜ルを合わせるずロヌド䞭だったものが衚瀺され、アセットをクリックするず Assets タブに衚瀺されたす。 + +## アプリケヌションの起動の蚘録 {#recording-the-start-of-the-application} + +アプリケヌションが最初に実行するフレヌムから蚘録するには、Inspector に `record: true` を枡すか、`EntityInspector` スクリプトの `record` 属性を蚭定したす。`app.init()` の盎埌のように、アプリケヌションが最初のフレヌムを実行する前に䜜成するず、Inspector はアプリケヌションの起動も蚘録したす。 + +```javascript +const app = new AppBase(canvas); +app.init(createOptions); + +// recording before the first frame records the start of the application too +const inspector = new Inspector(app, { record: true }); + +app.start(); +``` + +キャプチャはその埌、ペヌゞが開いおから最初のフレヌムたでの **Startup** ゚ントリから始たり、ペヌゞのリク゚スト、マむルストヌン、ロヌドされたアセット、メむンスレッドがブロックされた時間を含みたす。その詳现には、かかった時間、ロヌドされたもの、シェヌダヌのコンパむル、そしおリク゚ストず凊理を分けた最も遅いアセットが䞀芧衚瀺されたす。これはキャプチャの1000゚ントリの1぀なので、他の゚ントリず同じように新しいフレヌムに堎所を譲りたす。 + +Startup ゚ントリ。アプリケヌションの起動がチャヌトずそのタむムラむンに、マむルストヌン、アセット、リク゚ストずずもに衚瀺されおいたす + +コヌドから `inspector.recording` を蚭定するず、アプリケヌションの䞀郚の前埌でキャプチャを開始たたは停止できたす。 + +```javascript +// once the part to look at has run +inspector.recording = false; +``` + +## カりンタヌ {#counters} + +**Counters** セクションは、アプリケヌションが [`app.stats.user`](https://api.playcanvas.com/engine/classes/AppStats.html#user) に保持するカりンタヌを、各フレヌムの終了時の倀でチャヌト衚瀺したす。単䜍はアプリケヌションが決めるため、カりンタヌごずに独自のスケヌルを持぀線で衚瀺されたす。フレヌムの詳现にはその倀が、たずめお遞択したフレヌムではその平均、95パヌセンタむル、最倧倀が䞀芧衚瀺されたす。カりンタヌ自䜓に぀いおは [AppStatsによるプロファむリング](/user-manual/optimization/app-stats/)を参照しおください。 + +```javascript +// counted afresh each frame +app.on('frameupdate', () => app.stats.user.set('enemies', 0)); + +// wherever the application counts them +app.stats.user.set('enemies', app.stats.user.get('enemies') + 1); +``` + +## ゚ンゞンのビルド {#engine-builds} + +゚ンゞンのリリヌスビルドは、アップデヌトずレンダヌをそれぞれ党䜓ずしお蚈枬したす。プロファむラヌビルドずデバッグビルドでは、バッチャヌによるバッチの曎新ず䜜成を含むレンダヌのフェヌズ、ドロヌコヌルの内蚳、シェヌダヌのコンパむル、ラむトマップのベむクが远加されたす。 + +Inspector はアプリケヌションのアップデヌトの䞭で実行されるため、その時間は Inspector ずしお分けお衚瀺されたす。**Inspector time** をオフにするず CPU チャヌトから陀倖され、チャヌトはアプリケヌション自身の時間に合わせおスケヌルしたす。 + +## 数倀のコピヌ {#copying-the-figures} + +タブの名前を右クリックするずキャプチャ党䜓各フレヌムずその蚘録内容すべおを、チャヌトやセクションの名前、たたはそのリストの行を右クリックするずその系列をフレヌムごずに1行ずしお、JSON たたはスプレッドシヌト甚の CSV でコピヌしたす。どちらも、たずめお遞択したフレヌムがある堎合はそれらのフレヌムが察象になりたす。チャヌトでフレヌムを右クリックするずそのフレヌムを、たずめお遞択したフレヌムの䞭で右クリックするずその数倀を、タむムラむンを右クリックするずそのバヌをコピヌしたす。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/index.md deleted file mode 100644 index 2c12f0e7c1f..00000000000 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/debugging/index.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: デバッグ -description: ブラりザの開発者ツヌルを䜿っお PlayCanvas の Script のバグを芋぀け修正するツヌルず手法です。 ---- - -デバッグは、PlayCanvasスクリプト内の問題を特定し、修正するために䞍可欠です。コヌドが期埅通りに動䜜しない堎合、これらのツヌルずテクニックは問題を迅速に芋぀けお解決するのに圹立ちたす。 - -## デバッグテクニック - -### コン゜ヌルロギング - -コヌドが䜕をしおいるかを理解する最も手軜な方法です。実行フロヌを远跡し、倉数の倀を怜査するために`console.log()`ステヌトメントを远加したす。 - -**[コン゜ヌルロギングを孊ぶ →](./console-logging.md)** - -### ブラりザ開発者ツヌル - -ブレヌクポむント、ステップスルヌデバッグ、パフォヌマンスプロファむリングを䜿甚しお、実行䞭のコヌドを詳现に怜査したす。 - -**[ブラりザ開発者ツヌルを孊ぶ →](./browser-dev-tools.md)** - -### Inspector - -実行䞭のアプリケヌションの内郚を確認したす。゚ンティティずコンポヌネント、カメラ、アセット、GPUリ゜ヌス、各フレヌムのパス、そしおパスの描画を1぀ず぀確認できたす。 - -**[Inspectorを孊ぶ →](./inspector.md)** diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/index.md b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/index.md index 29a91ada48e..10a9cc4a416 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/index.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/user-manual/scripting/index.md @@ -68,5 +68,5 @@ Rotate.prototype.update = function(dt) { - [スクリプト属性](./script-attributes/index.md) — 蚭定可胜なプロパティの公開。 - [Engine API](./engine-api.md) — 䞻芁なクラスずパタヌン。 - [むベント](./events.md) — スクリプト間の通信。 -- [デバッグ](./debugging/index.md) — トラブルシュヌティングのためのツヌルず手法。 +- [デバッグ](/user-manual/debugging/) — トラブルシュヌティングのためのツヌルず手法。 - [移行ガむド](./migration-guide.md) — クラシックスクリプトからESMスクリプトぞのアップグレヌド。 diff --git a/llms/user-manual/engine/llms.txt b/llms/user-manual/engine/llms.txt index f42c23a1980..e1cf4888c7f 100644 --- a/llms/user-manual/engine/llms.txt +++ b/llms/user-manual/engine/llms.txt @@ -1,5 +1,5 @@ --- -covers: [engine, ecs, scripting, assets, graphics, gaussian-splatting, physics, animation, user-interface, xr, optimization, 2D] +covers: [engine, ecs, scripting, assets, graphics, gaussian-splatting, physics, animation, user-interface, xr, debugging, optimization, 2D] --- # PlayCanvas Engine @@ -52,7 +52,8 @@ Use this index to write code against the engine directly. React, Web Components - [Events](/user-manual/scripting/events/): Communicating between scripts with `on`, `once`, `off` and `fire`. - [Application Lifecycle](/user-manual/scripting/application-lifecycle/): The order in which an application initializes and runs its update loop. - [Migration Guide](/user-manual/scripting/migration-guide/): Converting classic scripts to ESM scripts step by step. -- [Debugging](/user-manual/scripting/debugging/): Finding script bugs with the browser's developer tools. +- [Debugging](/user-manual/debugging/): Finding bugs with logging, the browser's developer tools, the Inspector and debug drawing. +- [Inspector](/user-manual/debugging/inspector/): A debug panel for the running application: its entities, cameras, assets, frame graph, GPU resources and scripts, and stepping through the draws of a frame. ## Assets @@ -186,8 +187,10 @@ Use this index to write code against the engine directly. React, Web Components - [Platforms](/user-manual/xr/platforms/): Tested devices and browsers for VR, AR and each capability. - [Optimizing WebXR Applications](/user-manual/xr/optimizing-webxr/): Keeping the frame rate up despite stereo rendering, draw calls and AR tracking costs. -## Optimization +## Debugging and Optimization +- [Debugging and Optimization](/user-manual/optimization/): Which tool to use to debug and profile an application, and the goals of optimizing it. +- [Inspector Performance](/user-manual/optimization/inspector-performance/): Recording frames with the Inspector: frame, CPU, GPU and script times, loading and the start of the application, counters, and each frame on a timeline. - [General Guidelines](/user-manual/optimization/guidelines/): Tuning scripts, draw calls, batching, shaders, lighting, textures and post effects. - [Optimizing Load Time](/user-manual/optimization/load-time/): Image formats, texture sizes, preloading, asset audits, compression and staged loading. - [Texture Compression](/user-manual/optimization/texture-compression/): Reducing GPU memory and download size with Basis compressed textures. diff --git a/sidebars.js b/sidebars.js index f655aab2635..74f25400236 100644 --- a/sidebars.js +++ b/sidebars.js @@ -755,19 +755,8 @@ const sidebars = { }, 'user-manual/scripting/engine-api', 'user-manual/scripting/events', - { - type: 'category', - label: 'Debugging', - link: { - type: 'doc', - id: 'user-manual/scripting/debugging/index', - }, - items: [ - 'user-manual/scripting/debugging/console-logging', - 'user-manual/scripting/debugging/browser-dev-tools', - 'user-manual/scripting/debugging/inspector' - ], - }, + // the debugging of scripts is part of Debugging and Optimization, linked from here + { type: 'ref', id: 'user-manual/debugging/index', label: 'Debugging' }, 'user-manual/scripting/migration-guide' ], }, @@ -1217,22 +1206,48 @@ const sidebars = { }, { type: 'category', - label: 'Optimization', + label: 'Debugging and Optimization', link: { type: 'doc', id: 'user-manual/optimization/index', }, items: [ - 'user-manual/optimization/guidelines', - 'user-manual/optimization/texture-compression', - 'user-manual/optimization/mini-stats', - 'user-manual/optimization/app-stats', - 'user-manual/optimization/profiler', - 'user-manual/optimization/gpu-profiling', - 'user-manual/optimization/runtime-devicepixelratio', - 'user-manual/optimization/load-time', - 'user-manual/optimization/optimizing-scene-format', - 'user-manual/optimization/troubleshooting-performance', + { + type: 'category', + label: 'Debugging', + link: { + type: 'doc', + id: 'user-manual/debugging/index', + }, + items: [ + 'user-manual/debugging/console-logging', + 'user-manual/debugging/browser-dev-tools', + 'user-manual/debugging/inspector', + ], + }, + { + type: 'category', + label: 'Profiling', + items: [ + 'user-manual/optimization/mini-stats', + 'user-manual/optimization/app-stats', + 'user-manual/optimization/inspector-performance', + 'user-manual/optimization/profiler', + 'user-manual/optimization/gpu-profiling', + ], + }, + { + type: 'category', + label: 'Optimization', + items: [ + 'user-manual/optimization/guidelines', + 'user-manual/optimization/texture-compression', + 'user-manual/optimization/runtime-devicepixelratio', + 'user-manual/optimization/load-time', + 'user-manual/optimization/optimizing-scene-format', + 'user-manual/optimization/troubleshooting-performance', + ], + }, ], }, sectionHeader('Foundational APIs'), diff --git a/static/img/user-manual/scripting/debugging/chrome-debugger.png b/static/img/user-manual/debugging/chrome-debugger.png similarity index 100% rename from static/img/user-manual/scripting/debugging/chrome-debugger.png rename to static/img/user-manual/debugging/chrome-debugger.png diff --git a/static/img/user-manual/scripting/debugging/firefox-debugger.png b/static/img/user-manual/debugging/firefox-debugger.png similarity index 100% rename from static/img/user-manual/scripting/debugging/firefox-debugger.png rename to static/img/user-manual/debugging/firefox-debugger.png diff --git a/static/img/user-manual/scripting/debugging/inspector/debug-frame.webp b/static/img/user-manual/debugging/inspector/debug-frame.webp similarity index 100% rename from static/img/user-manual/scripting/debugging/inspector/debug-frame.webp rename to static/img/user-manual/debugging/inspector/debug-frame.webp diff --git a/static/img/user-manual/scripting/debugging/inspector/frame-graph.png b/static/img/user-manual/debugging/inspector/frame-graph.png similarity index 100% rename from static/img/user-manual/scripting/debugging/inspector/frame-graph.png rename to static/img/user-manual/debugging/inspector/frame-graph.png diff --git a/static/img/user-manual/scripting/debugging/inspector/inspector.png b/static/img/user-manual/debugging/inspector/inspector.png similarity index 100% rename from static/img/user-manual/scripting/debugging/inspector/inspector.png rename to static/img/user-manual/debugging/inspector/inspector.png diff --git a/static/img/user-manual/optimization/inspector-performance/performance-startup.webp b/static/img/user-manual/optimization/inspector-performance/performance-startup.webp new file mode 100644 index 00000000000..fde1d27b86b Binary files /dev/null and b/static/img/user-manual/optimization/inspector-performance/performance-startup.webp differ diff --git a/static/img/user-manual/optimization/inspector-performance/performance-timeline.webp b/static/img/user-manual/optimization/inspector-performance/performance-timeline.webp new file mode 100644 index 00000000000..0e9489690b3 Binary files /dev/null and b/static/img/user-manual/optimization/inspector-performance/performance-timeline.webp differ diff --git a/static/img/user-manual/optimization/inspector-performance/performance.webp b/static/img/user-manual/optimization/inspector-performance/performance.webp new file mode 100644 index 00000000000..5fae9d1b916 Binary files /dev/null and b/static/img/user-manual/optimization/inspector-performance/performance.webp differ diff --git a/utils/plugins/llms/test/corpus.test.mjs b/utils/plugins/llms/test/corpus.test.mjs index 5c0d41f0e23..065b96bab87 100644 --- a/utils/plugins/llms/test/corpus.test.mjs +++ b/utils/plugins/llms/test/corpus.test.mjs @@ -137,7 +137,7 @@ describe('the generated files', () => { }); it('keeps the code of every tab', () => { - const fences = section('/user-manual/scripting/debugging/console-logging/').match(/^```/gm); + const fences = section('/user-manual/debugging/console-logging/').match(/^```/gm); assert.equal(fences.length, 10); });