Skip to main content

Play and debug

Play runs your game inside the Studio window, so you can test changes without leaving the editor. Choose Debug before pressing Play to stop at breakpoints and step through your BT code.

Controls​

ControlShortcutAction
Release / Debug selector (toolbar)—Chooses how the next Play runs.
Play (toolbar)Ctrl+F5Saves all documents, loads the game and starts it. Resumes a game you returned from.
Stop (toolbar)Shift+F5Cancels loading, or closes the running game.
Return to Editor (shown above the game)—Pauses the game and gives the keyboard and mouse back to Studio.

While the game is running it receives all input. The toolbar buttons are hidden in small windows; the shortcuts still work.

While the game loads, a spinning icon replaces Play. Studio stays usable and you can press Stop at any time. Load errors appear in Output and the status bar.

After Return to Editor, Play resumes the paused game. If you changed the Release/Debug setting, Play restarts the game instead. Only one game runs at a time.

Release and Debug​

ModeWhat runsDebugger
ReleaseYour game as configured, at full speed.Off.
DebugYour BT sources, compiled for debugging (slower).Attached automatically.

Debug needs your BT sources. A packaged game with only compiled code cannot be debugged; open the source project instead. Projects with custom C code need a Studio built in the same configuration as the mode you pick; Studio tells you before building if they do not match.

Seeing your changes​

Changes do not reload into a running game.

You changedTo see it
BT scripts, scenes, data filesPress Stop, then Play. (Play after Return to Editor resumes the old game.)
Custom C code (native module)Press Build or Rebuild. Studio reloads the module and restarts the running game. Gameplay state resets. If the new module fails to start, Studio keeps the previous one. After building outside Studio, use Reload Module in Build Settings.
ShadersRebuild the game. Studio does not compile shaders live.
A render graph JSON fileRestart Play preview in Render Pipeline.
Studio pluginsPlugins: Reload (Ctrl+Alt+R).

For projects with custom C code, Play builds the module first. If the build fails, the game does not start.

Live Scene is a separate, smaller way to run your scene inside a panel.

Debugging​

Debug Play​

  1. Choose Debug in the toolbar.
  2. Set breakpoints: press F9 on a line of a .bt file, or click its line number.
  3. Press Play.

When the game hits a breakpoint, Studio comes to the front with the stopped line in Source Editor and the Debug Tools view open. Stepping keeps you in the editor; Continue returns you to the game. The debug session ends when the game stops.

Breakpoints last until you open another project. They are not saved.

Debug Tools​

The Debug Tools view (bottom area) controls the debugger.

ButtonShortcutEnabled when
ContinueF5Paused
PauseShift+F7Running
Step OverF10Paused
Step IntoF11Paused
Step OutShift+F11Paused
SectionContents
StatusStarting, attached, running, paused (with the reason), exited (with the exit code), or errors.
Call stackThe paused code's call stack (up to 12 frames). Click a frame to open its source and show its locals.
LocalsVariables of the selected frame.
Debug ConsoleType an Expression and press Evaluate while paused. Program output also appears here.
Standalone targetDebug something other than the game; see below.

Debugging outside Play​

The Standalone target section debugs a single program without Play. The Program field starts with the current .bt file.

ProgramStart Debugging (F6)
A .bt scriptCompiles it for debugging and runs it, stopping at the first line.
A .ctbt compiled programRuns it under the debugger.
A game executable built with debugging enabledRuns it under the debugger.

Programs run in the project folder. Stop (Shift+F6) ends the program, or disconnects if Studio attached to it. Run in Window starts a built game executable in its own window without the debugger; Stop Window closes it.

Debugging BT that your C code runs​

If your project's C code creates its own BT runtime, the debugger does not see it by default. To debug it, open Build Settings > Debug Host, enter the port and token your C code listens on, and choose Save Debug Host. Debug Play then attaches there instead of to the game's main BT code. Clear both fields and save to go back.

Your C code must use the debugger-capable BT runtime and load scripts compiled with ctbt --debug. Debug Play passes it the port and token in the BT_DEBUG_PORT and BT_DEBUG_TOKEN environment variables.

Limits​

  • One game at a time.
  • No conditional breakpoints, hit counts, logpoints, watch expressions or editing variable values.
  • Your game's code really runs, with full file and network access. Only open projects you trust; custom C code runs inside Studio itself.