From d1b2a312384549d0ae3e6569377150c4b202ff85 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 27 Apr 2026 16:29:51 +0200 Subject: [PATCH] Refactor: Only recreate runtime schedule context if the scene changes --- src/runtime-three/runtime-host.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index 0db89941..0ef2cb6f 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -5191,9 +5191,11 @@ export class RuntimeHost { return; } - this.runtimeScheduleSyncContext ??= createRuntimeScheduleSyncContext( - this.runtimeScene - ); + if (this.runtimeScheduleSyncContext?.runtimeScene !== this.runtimeScene) { + this.runtimeScheduleSyncContext = createRuntimeScheduleSyncContext( + this.runtimeScene + ); + } const syncResult = syncRuntimeSceneScheduleToClock({ runtimeScene: this.runtimeScene,