fix(preview): pause game loop before first frame for IDE cold-start step - #916
Merged
Merged
Conversation
game-boot now pauses director and game immediately after cc.game.resume() when window.__pinkStartPaused is set, so IDE-driven cold-start Step (PinK Preview In Editor) does not advance frames before its explicit single step; add a structural regression test pinning the pause-after-resume invariant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to SUD-GLOBAL/PinK#1419 (Preview In Editor cold-start Step).
Problem
PinK's Preview In Editor cold-start Step passes
{ paused: true, stepOnce: true }, but the pause was only applied afterview:ready, which fires after inspect assembly and the loading-overlay hide animation.game-boot.jscallscc.game.resume()in the scene-run callback, so the game advances many frames before the IDE pauses it (source-level repro: ~36 frames on the 600ms fallback path).Change
game-boot.js: whenwindow.__pinkStartPausedis set (injected by the IDE host before the boot chain), pause director + game immediately aftercc.game.resume(), i.e. before the first game-loop frame; wrapped in try/catch so engine state anomalies cannot break startup.game-boot-scene-load.test.ts.Validation
npx jest src/core/preview/test/game-boot-scene-load.test.ts: 6/6 passing.npx tsc -b: clean.