Editor

Play mode

EditorPreview

Editor docs

Play runs your game as it ships: the Game panel loads your project's own, unmodified index.html from its dev server. The editor is a preview.

Play, Pause, Step, Stop#

CommandShortcutWhat it does
Play → Play / StopCtrl+PStarts the game in the Game panel, or stops it.
Play → Pause / ResumeShift+Ctrl+PFreezes the game's clock, or lets it run again.
Play → StepAlt+Ctrl+PAdvances a paused game by one frame.
Play → Detach GameShift+Ctrl+DMoves the game into its own window; Reattach Game closes it.

The Game panel's toolbar has the same controls and shows the run's frame stats. On macOS use ⌘ for Ctrl.

Play controls reach the game through one call your entry file makes, attachEditorPlayControls(app) from virtual:ignifx/editor. The templates already make it. In a production build it is an empty function, so it costs nothing in a shipped game.

Stop ends the game and removes it from the panel; the next Play starts from scratch, which is the simplest way to reset everything the game did.

What playing does not change#

Play never writes to the scene document. Whatever the game does while it runs (entities spawned, values changed by scripts, physics moving things) stays in the play view and is gone when you stop. You can keep editing the scene in the scene view while the game plays; those edits are ordinary edits to the document, and the running game does not see them.

The game loads your project's files, as it would in a browser, not the editor's open document: save the scene before you press Play to play your latest edits.

Logs and errors#

The game's log lines, errors and hot-reload reports appear in the Console marked as coming from play, beside the editor's and the scene view's. An error names its entity, component and phase when the engine knows them, and a file:line link opens your code editor there.

Hot reload while playing#

Save a script in your code editor and the engine's hot reload patches it into the running game and into the scene view, without restarting either.

The detached game window#

Play → Detach Game opens the game in a window of its own, for testing full screen and pointer lock, which the docked Game panel does not allow. The window loads the game afresh, so a detached game restarts. While it is detached, the Play menu's controls are disabled; Reattach Game closes the window and returns the game to the panel.

Not yet: the live camera preview#

The plan gives the Game panel a second job: showing the scene through its own camera while you edit, without pressing Play. That needs engine work that is in progress and is not in the editor yet.