Show the debug overlay.


GML Code Example


Argument Description
enable switch on (true) or off (false) the debug overlay.

Returns: N/A


This function can be used to switch on and off the standard debug overlay when testing your game and is disabled by default. The debug overlay shows a graphic CPU/GPU usage bar in the actual game window itself along with the current real fps value, number of texture swaps and the number of vertex batches (note that texture swaps and vertex batches will never be zero and will normally show values of 2 or 3, since even with an empty room an no objects GameMaker: Studio still has to draw and batch things).

This bar is split into sections, with each section being 1/60th of a second. As you can see from the image above, the bar is made up of various colours:

  • Green - Input / Output processing (ie: keyboard, mouse, gamepad, networking etc...)
  • Red - The update speed of the step event
  • Yellow - The time required for the draw event
  • Orange -Debug update time, which is only normally visible when you use the debug module
  • White - GPU left over time, which is the time spent waiting for the GPU to finish the rendering of the frame before the next one can start
  • Cyan - The text rendering time
  • Grey - The time required to clear screen each draw step
  • Dark Red - The GPU flush, which is how long the GPU takes to clear images from memory

Using this function you can add the overlay whether in debug mode or not, and in this way, you can see how efficiently your game runs and get a visual cue as to how it is using the available resources, without the over-head of having the debugger running alongside.


GML Code Example

if global.debug

The above code will toggle the debug on or off depending on the value of a global variable.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here