Skip to content

Commit a72120a

Browse files
authored
Inspector: Add warn if the inspected node outside of frame scope (#32458)
1 parent 3e8ca1e commit a72120a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

examples/jsm/inspector/RendererInspector.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import { InspectorBase, TimestampQuery } from 'three/webgpu';
2+
import { InspectorBase, TimestampQuery, warnOnce } from 'three/webgpu';
33

44
class ObjectStats {
55

@@ -330,7 +330,17 @@ export class RendererInspector extends InspectorBase {
330330

331331
inspect( node ) {
332332

333-
this.currentNodes.push( node );
333+
const currentNodes = this.currentNodes;
334+
335+
if ( currentNodes !== null ) {
336+
337+
currentNodes.push( node );
338+
339+
} else {
340+
341+
warnOnce( 'RendererInspector: Unable to inspect node outside of frame scope. Use "renderer.setAnimationLoop()".' );
342+
343+
}
334344

335345
}
336346

0 commit comments

Comments
 (0)