Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
gdevelop5:interface:debugger [2018/04/25 01:08]
4ian created
gdevelop5:interface:debugger [2019/05/29 11:13] (current)
akbarhabeebb [Profile the performance of your game.] Typo
Line 1: Line 1:
-# Debugger ​for game previews+Game Debugger ​and Profiler
  
-The debugger ​is a tool that let you inspect the content of your game, in particular the variables (global variables, scene variables and variables of instances ​of objects) and the instances living in the scenes ​of your game+A *Debugger* ​is a tool that lets you inspect the content of your game. In particular, you can inspect ​the global variables, scene variables and variables of instances of your objectsIt is a powerful tool. 
-You can pause the game at any momentIt'​s ​a great way to understand why something is not working as intended or to do quick tests in the game.+ 
 +You can pause the game at any timeUsing the Debugger is a great way to understand why something is not working as intended or to do quick tests in the game. 
 + 
 +The *profiler* is a tool that measures the time spent in different parts of the engine while your game is running. It helps to find bottlenecks or events that could take a lot of resources in your game. [[gdevelop5:​interface:​debugger:​profile-your-game|Read more about using the profiler here!]] ​
  
 <​note>​ <​note>​
 This is an advanced feature of GDevelop. If you use it, we would like you to show your support for GDevelop by [[gdevelop5:​interface:​profile|getting a subscription]]! This is an advanced feature of GDevelop. If you use it, we would like you to show your support for GDevelop by [[gdevelop5:​interface:​profile|getting a subscription]]!
 </​note>​ </​note>​
 +
 +{{ :​gdevelop5:​interface:​gdevelop-debugger_2x.png?​nolink |}}
 +
 +## Launch the debugger
 +
 +To launch the debugger, in the toolbar of a scene editor, click on the "​Debug"​ icon:
 +
 +{{ :​gdevelop5:​interface:​debug-icon_2x.png?​nolink |}}
 +
 +In the menu, choose "​Preview with debugger and performance profiler"​.
 +This will open a new tab called "​Debugger"​ and will also launch a preview of your game as usual.
 +
 +Note that even if you close the preview, you can let the debugger tab stay unclosed. This way, any preview that you launch (with the usual Preview button) will be connected to the debugger.
 +
 +When the game is just launched, the debugger is empty:
 +
 +{{ :​gdevelop5:​interface:​empty-debugger_2x.png?​nolink |}}
 +
 +Click on **"​Refresh"​** at any time to fetch the data of the game.
 +
 +{{ :​gdevelop5:​interface:​debugger-refresh-button_2x.png?​nolink |}}
 +
 +You can also use the **Pause** button in the toolbar.
  
 ## Inspect the scenes of the game ## Inspect the scenes of the game
 +
 +The currently running scenes are listed below Scenes item in the list:
 +
 +{{ :​gdevelop5:​interface:​inspector-list.png?​nolink |}}
 +
 +If you click on a Scene name, you will display on the right the inspector for this scene. This inspector contains the layer of the scene and a button to create a new instance of an object on the scene.
 +
 +
  
 ### Create a new instance on the scene ### Create a new instance on the scene
 +
 +To create a new instance, click on the name of the scene where you want to create the instance.
 +Write the name of the object and click on Create:
 +
 +{{ :​gdevelop5:​interface:​create-instance.png| }}
 +
 +The instance will be created at position 0;0, on base layer with Z-order 0.
 +You can then find it in the list of instances and change its position, angle, layer...
  
 ## Inspect and edit the instances ## Inspect and edit the instances
 +
 +In the list, you can find **Instances** of every running scene.
 +Instances are grouped by objects name. Click on an object name to see the list of instances of this object living on the scene. Click on an instance number (each instance has a unique number) to inspect it:
 +
 +{{ :​gdevelop5:​interface:​instance-inspector.png |}}
 +
 +The inspector shows general properties of the instance, for example, position, rotation, layer... For each of these properties, you can **edit them by clicking on the value**:
 +
 +{{ :​gdevelop5:​interface:​debugger-inspector-edit-value.png?​nolink |}}
 +
 +Validate your changes by clicking on the small **validate button** (the one with the tick icon).
 +
 +You can also see the **variables of the instance** and modify them (see below for more information about variables).
  
 ## Inspect and edit the variables ## Inspect and edit the variables
 +
 +You can inspect variables of the game (global variables), of a scene (scene variables) or of a particular instance of an object (instance variables).
 +
 +To do this, in the list, click on **Global Variables**,​ **Scene variables** or the instance number that you want to inspect.
 +
 +Variables will be shown in a list showing variable name and values (either a number or a text). Here is an example of an instance of an object having a "​Life"​ variable:
 +{{ :​gdevelop5:​interface:​instance-variables.png?​nolink |}}
 +
 +Like other fields, you can **click on the value of the variable** to change it. It's a good way to see how your game is behaving according to the value of variables and test that your events are working properly.
 +
 +Variables can also be **structures**,​ meaning that they hold other variables. In this case, instead of seeing the value (number or text) of the variable, you will see a sub-list containing the children variables:
 +
 +
 +Here is an example of a variable "​Options",​ containing children variables to store the options of a game:
 +{{ :​gdevelop5:​interface:​structure-variable-inspector.png?​nolink |}}
 +
 +You can also change the value of the children variables like any other.
 +
 +## Profile the performance of your game.
 +
 +A profiler is a tool included in the Debugger that measures the time spent in various part of the engine while your game is running. It then shows a breakdown of each section, including events. [[gdevelop5:​interface:​debugger:​profile-your-game|Read more about using the profiler here!]] ​