Skip to content

Commit

Permalink
fix: skip scene children
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Nov 6, 2023
1 parent d3ad408 commit 8aa5c6e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/fiber/src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ export function buildGraph(object: THREE.Object3D) {
// Disposes an object and all its properties
export function dispose<TObj extends { dispose?: () => void; type?: string; [key: string]: any }>(obj: TObj) {
if (obj.dispose && obj.type !== 'Scene') obj.dispose()
for (const key in obj) obj[key].dispose?.()
for (const key in obj) {
const value = obj[key]
if (value.type === 'Scene') continue
value.dispose?.()
}
}

// Each object in the scene carries a small LocalState descriptor
Expand Down

0 comments on commit 8aa5c6e

Please sign in to comment.