show_debug_overlay


Description

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 2 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:

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.


Syntax:

show_debug_overlay(enable);

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


Returns:

N/A


Example:

if global.debug
   {
   show_debug_overlay(true);
   }
else
   {
   show_debug_overlay(false);
   }

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