Skip to content

Releases: SirQuartz/debugconsole

v1.2.3

Choose a tag to compare

@SirQuartz SirQuartz released this 01 Jul 04:19
cebcce3
  • Refactored several lines of code to be much cleaner and easier to read
  • Fixed a small bug where the placeholder text on the Input line wouldn't disappear after closing the help popup
  • Fixed a regression that stopped the shoot command from working
  • The shoot command will now accept screenshot as a valid prefix

v1.2

Choose a tag to compare

@SirQuartz SirQuartz released this 30 Jun 17:01
2cc3207

This version includes several new commands and features, as well as fixing many minor inconsistencies and improving usability.

List of changes

  • Added the shoot command, which allows you to take screenshots of the viewport in-game.
  • Added the debug ray command to display collision shapes and raycasts in 2D and 3D scenes.
  • The input line now displays placeholder text instead of actual text so the message will disappear when you start typing.
  • Added a new user_space variable for saving screenshots in user-space in exported games.
  • Updated the help menu to correctly display MSAA options
  • Added a note at the bottom of the help window saying that debug draw will not work on GLES2 and only with a debug binary
  • The modify time command now properly outputs the change made to the output log, and you can no longer set a negative time value
  • The fxaa command now prints "fxaa set to off/on" instead of "set to true/false" to the output log
  • The reload command now prints that the scene has been reloaded to the output log
  • Added the ability to call any method on an object within the scene, even on singletons

Screenshots

The first new thing I've added is a new shoot command which will allow you to take a screenshot of the viewport. It does this by hiding the debug overlay, getting the viewport texture, asking you to name the screenshot, and then saving it in a folder called "Screenshots" in your project's root directory. This sounds complicated, but it's just a two-step process for the user, the rest is handled automatically for you behind the scenes. All you do is type shoot, then it will ask for you to name the file.

Note: If you name the screenshot something that already exists in the screenshots folder it will automatically overwrite that existing file. You also don't need to type the extension of the file, it does that for you, all you need to do is enter the name.

You'll also find that I've added an additional exported boolean called user_space on the Input node that allows you to save screenshots to the user:// directory instead of the res:// directory, by default it's disabled.

Manual Method Calls

Next up, I've added the ability to call almost any function on any node within your scene, even on singletons, from the debug console.

You just type Object.method. With "Object" being the exact name of the node as it appears in your scene, and "method" being the exact name of the method you wish to call. It does this by first checking that the object exists somewhere within your scene. This is case-sensitive so you need to keep that in mind. And yes, this will work on custom methods in scripts attached to the node.

Note: The method you call must actually exist within this specific object or exist within the object(s) it inherits from, or exist in a script attached to the object if it's a custom method.

It can also accept up to three optional arguments separated by spaces.

Right now this is command is limited to accepting 3 optional arguments for whatever function you call (I might increase that amount in the future). This is by far the most powerful feature I'll be adding to this console plugin, although, it's not perfect right now. Another limitation is that if your scene has multiple child objects with the exact same name it will only call the method on the first occurrence of the child object in the scene tree hierarchy. So I'd recommend giving all your nodes unique names (which you should be doing anyway just because it's a best practice).

Note: While debugging your game in the editor, if you enter a method call without the correct number of arguments for a function, or the argument itself is incorrect, the game will crash. However, in an exported game, whether it's in debug mode or not, this will simply be ignored.

Debug Ray

Lastly, I've added a debug ray command that will show all the collisions shapes and RayCasts in 2D or 3D scenes. This command requires that the scene be reloaded in order for the changes to take effect. This command also requires that you are using a debug binary of your game if you export it in order for this command to work.


In this scene, I've placed a single raycast that originates just off the center of the screen and shoots out to the right of the camera. It's represented by the orange line.

v1.1

Choose a tag to compare

@SirQuartz SirQuartz released this 23 Jun 13:11
60ad591

Small bug fix for input, now you change the "debug" action to be something other than the "~" key in your project's input map.