GodotPublicSignalPublisherGenerator 1.0.8
This version works provided there are no conflicts of namespaces for signal arguments for example if you have a custom class MenuButton which Godot also has on its own then the 1.0.8 generator can't figure it out and will give you an IntelliSense error. This has been remedied in 1.0.9.
See the version list below for details.
dotnet add package GodotPublicSignalPublisherGenerator --version 1.0.8
NuGet\Install-Package GodotPublicSignalPublisherGenerator -Version 1.0.8
<PackageReference Include="GodotPublicSignalPublisherGenerator" Version="1.0.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="GodotPublicSignalPublisherGenerator" Version="1.0.8" />
<PackageReference Include="GodotPublicSignalPublisherGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add GodotPublicSignalPublisherGenerator --version 1.0.8
#r "nuget: GodotPublicSignalPublisherGenerator, 1.0.8"
#:package GodotPublicSignalPublisherGenerator@1.0.8
#addin nuget:?package=GodotPublicSignalPublisherGenerator&version=1.0.8
#tool nuget:?package=GodotPublicSignalPublisherGenerator&version=1.0.8
Godot Public Signal Publisher Generator
A C# source generator that automatically creates public emission methods for public Godot signals in your code.
Purpose
This source generator simplifies signal emission in Godot by automatically generating public SignalEmit
methods for your signals. Instead of using the generic EmitSignal
method, you get strongly-typed methods specific to each signal.
Requirements
- .NET 6.0 or later
- Godot 4.0 or later
Installation
Install the NuGet package in your Godot project:
dotnet add package GodotPublicSignalPublisherGenerator
Usage
- Define your signals using public delegates with the
[Signal]
attribute - Make sure your class is
partial
- The generator will automatically create corresponding
SignalEmit
methods
Example
public partial class YourNode : Node
{
// Define your signal
[Signal]
public delegate void HealthChangedEventHandler(int oldHealth, int newHealth);
private int _health = 100;
public void TakeDamage(int damage)
{
var oldHealth = _health;
_health -= damage;
// Use the generated method
SignalEmitHealthChanged(oldHealth, _health);
}
}
The source generator will automatically create:
public partial class YourNode
{
public void SignalEmitHealthChanged(int oldHealth, int newHealth)
{
EmitSignal(SignalName.HealthChanged, oldHealth, newHealth);
}
}
Naming Convention
- Your signal delegate names must end with
EventHandler
- The generated emission methods will be named
SignalEmit
followed by the signal name (without theEventHandler
suffix)
Features
- Strongly-typed signal emission methods
- Compile-time validation
- Clean and intuitive API
- Supports all Godot-compatible parameter types
- Works with nested partial classes
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.