Skip to content

Destroy the material of each debris crate in the entity inspector example - #9692

Merged
mvaligursky merged 1 commit into
mainfrom
mv-entity-inspector-material-leak
Oct 7, 2026
Merged

mvaligursky merged 1 commit into
mainfrom
mv-entity-inspector-material-leak

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Fixes a material leak in the entity inspector example: on WebGPU the device's uniform buffer count grew by about 2.5 a second without bound.

Changes:

  • The example spawns a debris crate every 0.4 s, each with its own StandardMaterial, and destroying a crate's entity left its material alive, along with the uniform buffer the material registers with the device. The material is now destroyed together with its crate, so the count stays flat once the debris pool is full. Crates still keep appearing and disappearing, each with its own shade.

Examples:

  • debug/entity-inspector

…y inspector

The entity inspector example creates a StandardMaterial for every debris crate
it spawns, and destroying the crate's entity leaves that material alive. Each
one holds a uniform buffer registered with the device, so on WebGPU the
device's uniform buffer count grew by one per crate, about 2.5 a second,
without bound. The material is now destroyed with its crate.
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2508.7 KB — 648.4 KB — 503.4 KB —
playcanvas.min.mjs 2505.5 KB — 647.0 KB — 503.2 KB —

@mvaligursky
mvaligursky merged commit 7e8b6db into main Oct 7, 2026
11 checks passed
@mvaligursky
mvaligursky deleted the mv-entity-inspector-material-leak branch October 7, 2026 12:44

This branch was successfully deployed

2 active deployments
Preview – engine — 6612e28e Deployed Oct 7, 2026 by vercel[bot]
Preview – engine-api-docs — 6612e28e Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant