Introduction
The Live Edit feature in FlatRedBall enables making a change to your game when in edit mode and applying those changes without restarting your application. It enables a variety of types of editing, and this list is continually growing.
Enabling Live Edit
To enable Live Edit in your game:
- Click the Editor Settings button. This brings up the Editor Settings tab
- Check the option to Enable Live Edit
Once this option is checked, FlatRedBall generates the necessary code to enable Live Edit in your game. This includes a connection between the FlatRedBall Editor and your game, using the port specified in the Port Number text box. Usually you do not need to change this port, but it can be changed if it conflicts with other applications.
Once Live Edit is enabled, you can run your game and enable live edit in a number of ways.
- Run in Edit Mode – You can directly launch your game by clicking the Run in Edit Mode button
- Alternatively, you can launch your game in the FRB Editor…
… and then switch to edit mode
- Run your game in Visual Studio. FRB automatically detects when the game is running and displays the edit mode button. You can run your game in edit mode even if you didn’t launch it through FRB
As shown above, you can tell that your game is in edit mode if it displays a grid.
You can switch between Edit and Play mode anytime by toggling the play and edit buttons.
Selecting and Previewing
If in edit mode, the selected level displays in the game. You can change selections and the game will switch what is displayed in realtime.
- Select an entity to view it in game. The game creates a preview screen allowing you to view and edit the entity by itself.
- States can also be previewed by selecting a state in the StateData editor grid to preview it as well
Camera Controls
The Camera in Edit mode can be controlled using the following methods:
Moving and Changing Object Variables
Changes in FlatRedBall immediately apply if the game is in edit mode. The following edits are supported in Live Edit:
- Push+drag to move objects in the game – the variables will update automatically in Glue to match the new position
- Multiple objects can be selected and moved at once by holding down the CTRL key and clicking each object
- Pushing the left mouse button in a blank space and dragging results in a rectangle which can be used to select multiple objects
Creating New Objects
Creating a new object in FlatRedBall automatically updates the game with the new object. New objects can be added to levels or entities.
- New objects can be created by using the CTRL+C, CTR+V shortcut in game. This is especially useful when placing multiple objects in game. When pasting a grabbed object, the new object will be placed at the location of the crusor.
Working with Files
FlatRedBall supports adding files at runtime and automatically updating to changes.