-
Notifications
You must be signed in to change notification settings - Fork 10
In‐Game Debugging
If the videos do not load please try refreshing the page.
2024-09-10.13-40-24.mp4
2024-09-08.21-37-51.mp4
Easily debug in-game by adding the [Visualize] attribute to any of the supported members. This feature allows you to visualize and interact with various types of data directly within the game environment.
| Member Type | Supported | Example Types | Additional Notes |
|---|---|---|---|
| Numericals | ✅ |
int, float, double
|
All numerical types are supported |
| Enums | ✅ |
Direction, Colors
|
All enum types are supported |
| Booleans | ✅ | bool |
|
| Strings | ✅ | string |
|
| Color | ✅ | Color |
|
| Vectors | ✅ |
Vector2, Vector2I, Vector3, Vector3I, Vector4, Vector4I
|
|
| Quaternion | ✅ | Quaternion |
|
| NodePath | ✅ | NodePath |
|
| StringName | ✅ | StringName |
|
| Methods | ✅ | Method parameters support all listed types here | |
| Static Members | ✅ | This includes static methods, fields, and properties | |
| Arrays | ✅ |
int[], string[], Vector2[]
|
Arrays support all listed types here |
| Lists | ✅ |
List<string[]>, List<Vector2>
|
Lists support all listed types here |
| Dictionaries | ✅ | Dictionary<List<Color[]>, Vector2> |
Dictionaries support all listed types here |
| Structs | ✅ | struct |
|
| Classes | ✅ | class |
|
| Resources | ✅ | Resource |
|
| Godot Classes | ❌ |
PointLight2D, CharacterBody3D
|
|
| Godot Array | ❌ | Godot.Collections.Array |
Tracking in https://github.com/ValksGodotTools/Template/issues/58 |
| Godot Dictionary | ❌ | Godot.Collections.Dictionary |
Tracking in https://github.com/ValksGodotTools/Template/issues/58 |
Important
There are some annoyances when trying to visualize members from inherited classes. I will try to solve this later.
// You will be able to view realtime changes to curState, Position and Rotation
[Visualize(nameof(curState), nameof(Position), nameof(Rotation))]
public partial class Player : CharacterBody2D
{
// You will be able to edit this in-game
[Visualize] private static int _totalPlayers;
// Visualize will check every 1000ms if currentState gets defined
State currentState;
VisualLogger _visualLogger = new();
public override void _Ready()
{
currentState = new State("Idle");
}
// You will be able to execute this method in-game
[Visualize]
public void Attack(int damage)
{
_visualLogger.Log(damage);
}
}Important
Static functions are not yet supported. Should be easy to implement, I have not got around to doing it yet.
Adding the ConsoleCommand attribute to any function will register it as a new console command.
Note
The in-game console can be brought up with F12
[ConsoleCommand("help")]
void Help()
{
IEnumerable<string> cmds = Game.Console.Commands.Select(x => x.Name);
Game.Log(cmds.Print());
}Console commands can have aliases, this command has an alias named "exit"
[ConsoleCommand("quit", "exit")]
void Quit()
{
GetTree().Root.GetNode<Global>("/root/Global").Quit();
}Most method parameters are supported, allowing for more dynamic interactions
[ConsoleCommand("debug")]
void Debug(int x, string y)
{
Game.Log($"Debug {x}, {y}");
}