Babylon.js EditorDownload

Running project

Play, stop, and refresh your scene directly from the editor without leaving the workspace.

Introduction

Projects can be played directly from the editor. A project can be composed of multiple scenes and some scripts may be attached to objects in the scene(s). There are 2 options:

  • play the current scene: all the scripts are compiled on the fly and executed in the current scene that is displayed in the editor, sharing the same resources (textures, etc.). This is the default behavior of the editor.
  • play the project as-is: consists on running the dev command using the project's selected package manager (npm, yarn, bun or pnpm).

Playing the current scene

To start the current scene, just click the start button located in the toolbar of the editor's preview panel.

Each time the current scene is played, the editor will update the assets located in the public folder of the project. If new assets were added to the project (especially images), this can take a few seconds to generate all new necessary files before the project can be played. The same files can be generated from the command line using the Babylon.js Editor CLI.

Note that when playing, all the scripts are watched for changes and will be reloaded automatically when modified until the "play" mode is stopped.

Stopping the current scene

To stop the current scene being played and get back to the edit mode, just click the stop button located in the toolbar of the editor's preview panel.

Refreshing the current scene

Sometimes, it's useful to refresh the scene that is being played instead of stopping it and starting it again. This allows to bypass the export process or the editor. Just click the refresh button located in the toolbar of the editor's preview panel.

Playing and stopping the scene is also available as a keyboard shortcut.