LokiCat.PankuConsole.DotNet.CommandGenerator
0.0.23
dotnet add package LokiCat.PankuConsole.DotNet.CommandGenerator --version 0.0.23
NuGet\Install-Package LokiCat.PankuConsole.DotNet.CommandGenerator -Version 0.0.23
<PackageReference Include="LokiCat.PankuConsole.DotNet.CommandGenerator" Version="0.0.23" />
<PackageVersion Include="LokiCat.PankuConsole.DotNet.CommandGenerator" Version="0.0.23" />
<PackageReference Include="LokiCat.PankuConsole.DotNet.CommandGenerator" />
paket add LokiCat.PankuConsole.DotNet.CommandGenerator --version 0.0.23
#r "nuget: LokiCat.PankuConsole.DotNet.CommandGenerator, 0.0.23"
#:package LokiCat.PankuConsole.DotNet.CommandGenerator@0.0.23
#addin nuget:?package=LokiCat.PankuConsole.DotNet.CommandGenerator&version=0.0.23
#tool nuget:?package=LokiCat.PankuConsole.DotNet.CommandGenerator&version=0.0.23
ConsoleCommandBridgeGenerator
A Roslyn incremental source generator that bridges C# methods to the PankuConsole in Godot via GDScript wrappers.
It automatically generates a ConsoleBridge.gd file with @panku_command functions, exposing decorated C# methods to the in-game developer console.
✨ Features
- ✔️ Auto-generates
@panku_commandwrappers for[ConsoleCommand]methods - ✔️ Supports async methods (
Task) - ✔️ Supports optional/default parameters with arity overloads
- ✔️ Groups commands by class name using
ClassName.MethodName() - ✔️ Emits PascalCase if custom name is given
- ✔️ Self-contained — no need to define the attribute manually
🚀 Quick Start
Install the generator (via NuGet or project reference)
Add the attribute to your method:
public partial class PlayerDebug : Node {
[ConsoleCommand] // exposed as: PlayerDebug.Kill()
public void Kill(string reason = "test") => GD.Print(reason);
}
- Or override the name completely:
[ConsoleCommand("kill_now")] // exposed as: kill_now()
public void Kill(string reason = "test") => GD.Print(reason);
- Use it in Godot via PankuConsole:
> PlayerDebug.Kill("fall")
> kill_now("fall")
🧾 Command Name Mapping
| C# Declaration | Exposed Console Command |
|---|---|
[ConsoleCommand] on PlayerDebug.Kill() |
PlayerDebug.Kill() |
[ConsoleCommand("kill_now")] on PlayerDebug.Kill() |
kill_now() |
[ConsoleCommand] on GameDebug.ResetGame() |
GameDebug.ResetGame() |
📄 Generated Output
For [ConsoleCommand] method:
public class GameDebug : Node {
[ConsoleCommand]
public void ResetGame(int delay = 5) => GD.Print("Reset in", delay);
}
Generates GDScript:
@panku_command
func game_debug.ResetGame(delay: int):
GameDebug.ResetGame(delay)
@panku_command
func game_debug.ResetGame():
GameDebug.ResetGame(5)
🧐 Notes
- Only methods on
Node-derived types are supported - Custom command name disables grouping and uses it verbatim
- All generated commands live in
ConsoleBridge.gd
📦 Integration
Make sure ConsoleBridge.gd is added to your scene and ready at runtime. It will @onready bind to your C# nodes using the %NodeName syntax.
💪 License
MIT
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- System.Text.Json (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|