Login Register
Advanced Control and File Management

Control Commands for Play Mode and Scene Management

Estimated reading: 0 minutes 9 views

Control commands manage Unity Editor state: play mode, console, scenes, and recompilation. They let Vex interact with the editor itself, not just objects in the scene.

Play mode: play_mode with states: play, stop, pause, toggle. Vex uses this to test your game after changes.

Console:

  • console.write — Writes Log, Warning, or Error messages
  • console.clear — Clears all console messages
  • console.get — Reads recent messages. Vex checks this after play mode to catch errors.

Scenes:

  • scene.load — Loads a scene by path
  • scene.save — Saves the current scene (or Save As with a path)
  • scene.activate — Activates a scene when multiple are loaded

Recompilation:

  • unity.freeze_recompile — Freezes recompilation for batch file creation
  • unity.recompile_now — Triggers recompilation manually
  • unity.batch_operation — Full batch system with begin, execute, abort, status actions (covered in Chapter 9)

Example: You say “Test the player movement.” Vex calls play_mode state="play", waits, then console.get to check for errors. If clean: “Play mode active. No errors. Player responds to physics.”

Batch operations:

The unity.batch_operation command is one of the most time-saving features in GameCatalyst. It freezes recompilation with action="begin", lets Vex create as many scripts as needed, then triggers a single recompile with action="execute". Ten scripts, one recompile. Fifty scripts, still one recompile. The time savings are enormous for large feature builds.

Recompile freeze and unfreeze:

unity.freeze_recompile is a simpler version — it just freezes or unfreezes recompilation. Batch operations use this internally but you can also call it directly. unity.recompile_now forces an immediate recompile, useful after manually editing files or when you want Unity to process pending changes right away.

Console as a diagnostic tool:

Vex uses console.get after entering play mode to detect runtime errors. If the console shows errors, Vex reports them to you with analysis. If the console is clean, Vex confirms the test passed. This automated check cycle is part of the verification process in workspace plans.

Scene management workflow:

A typical scene workflow might be: Vex calls scene.save to save your current work, then scene.load to open a test scene, then play_mode state="play" to test, then console.get to check for errors, then play_mode state="stop" to finish, and finally scene.load to return to your original scene. All automated, all in seconds.

Share this Doc

Control Commands for Play Mode and Scene Management

Or copy link

CONTENTS
Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot Avatar
What can I help you with?