From 6628019296b43cd57aed843e14e6be6c3e9f8d00 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 27 Apr 2026 16:29:55 +0200 Subject: [PATCH] Refactor: Only recreate editor simulation context if the scene changes --- src/runtime-three/editor-simulation-controller.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/runtime-three/editor-simulation-controller.ts b/src/runtime-three/editor-simulation-controller.ts index 0a02e6da..b096edca 100644 --- a/src/runtime-three/editor-simulation-controller.ts +++ b/src/runtime-three/editor-simulation-controller.ts @@ -354,9 +354,13 @@ export class EditorSimulationController { } try { - this.runtimeScheduleSyncContext ??= createRuntimeScheduleSyncContext( - this.runtimeScene - ); + if ( + this.runtimeScheduleSyncContext?.runtimeScene !== this.runtimeScene + ) { + this.runtimeScheduleSyncContext = createRuntimeScheduleSyncContext( + this.runtimeScene + ); + } syncRuntimeSceneToClock( this.runtimeScene, this.currentClock,