LokiCat.Godot.R3.ObservableSignals 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package LokiCat.Godot.R3.ObservableSignals --version 1.0.9
                    
NuGet\Install-Package LokiCat.Godot.R3.ObservableSignals -Version 1.0.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LokiCat.Godot.R3.ObservableSignals" Version="1.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LokiCat.Godot.R3.ObservableSignals" Version="1.0.9" />
                    
Directory.Packages.props
<PackageReference Include="LokiCat.Godot.R3.ObservableSignals" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LokiCat.Godot.R3.ObservableSignals --version 1.0.9
                    
#r "nuget: LokiCat.Godot.R3.ObservableSignals, 1.0.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LokiCat.Godot.R3.ObservableSignals@1.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LokiCat.Godot.R3.ObservableSignals&version=1.0.9
                    
Install as a Cake Addin
#tool nuget:?package=LokiCat.Godot.R3.ObservableSignals&version=1.0.9
                    
Install as a Cake Tool

LokiCat.Godot.R3.ObservableSignals

R3-compatible source generator for turning [Signal] delegates in Godot C# into cached Observable<T> properties.

This package eliminates boilerplate when wiring up Godot's [Signal] system to R3's reactive observables. It generates cached, lazily-connected observables for every [Signal] delegate in your partial Godot classes.


✨ Features

  • Automatically detects [Signal]-annotated delegate declarations in Godot C# scripts
  • Generates type-safe Observable<T> or Observable<(T1, T2, ...)> properties
  • Supports 0 to 5 parameters
  • Emits clean diagnostic warnings for [Signal] delegates with more than 5 parameters
  • Requires no manual wiring or Observable.Create logic
  • Complies with .editorconfig and follows your R3 usage patterns
  • Output is fully compatible with AddTo(this) disposal and R3 pipelines

📦 Installation

  1. Add this NuGet package to your project:
dotnet add package LokiCat.Godot.R3.ObservableSignals
  1. Ensure your Godot node classes are marked partial, and your [Signal] delegates are defined inside the class:
public partial class VisionCone2D : Node2D {
  [Signal]
  public delegate void BodyEnteredEventHandler(Node body);
}
  1. Build your project. The generator will automatically emit:
private Observable<Node> _onBodyEntered;
public Observable<Node> OnBodyEntered =>
  this.Signal(nameof(BodyEntered), ref _onBodyEntered);

You can now subscribe:

visionCone.OnBodyEntered
  .Subscribe(body => GD.Print($"Entered: {body.Name}"))
  .AddTo(this);

✅ Supported Signal Forms

Signal form Generated Observable type
delegate void Something() Observable<Unit>
delegate void Something(Node) Observable<Node>
delegate void Something(Node, int) Observable<(Node, int)>
... up to 5 args Observable<(T1, T2, ..., T5)>

Signals with 6+ arguments will trigger a diagnostic warning and be skipped.


🧠 How It Works

  • The generator looks for [Signal] delegate declarations inside partial classes.
  • For each signal, it emits a private Observable<T>? field and a public Observable<T> property.
  • It uses the Signal(...) extension method (also emitted by the generator) to wrap Godot.Connect(...) with Observable.Create(...).
  • The generated observables are cached and lazily initialized on first access.

🛠 Example: Full Class

public partial class ButtonGroup : Node {
  [Signal]
  public delegate void PressedEventHandler(BaseButton button);
}

⬇️ Generates:

private Observable<BaseButton> _onPressed;
public Observable<BaseButton> OnPressed =>
  this.Signal(nameof(Pressed), ref _onPressed);

🧪 Troubleshooting

  • Make sure your classes are marked partial
  • Your [Signal] delegates must be declared inside the class
  • Check .g.cs output in obj/Debug/.../generated/
  • Use #nullable enable if you use nullable types in your [Signal] delegate
  • You must rebuild your project to trigger generation

📄 License

MIT License


💡 Bonus Tip

Pair this generator with Chickensoft, R3, Godot, and other LokiCat Godot/.NET packages for fully reactive, event-driven game logic in idiomatic C#.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • net7.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.

Version Downloads Last Updated
1.0.70 236 7/2/2025
1.0.69 118 6/21/2025
1.0.68 105 6/21/2025
1.0.65 141 6/19/2025
1.0.64 140 6/19/2025
1.0.63 139 6/19/2025
1.0.62 137 6/19/2025
1.0.61 140 6/19/2025
1.0.60 141 6/19/2025
1.0.59 139 6/19/2025
1.0.58 142 6/19/2025
1.0.57 139 6/19/2025
1.0.56 144 6/19/2025
1.0.55 139 6/19/2025
1.0.54 139 6/18/2025
1.0.53 140 6/18/2025
1.0.52 137 6/18/2025
1.0.51 145 6/18/2025
1.0.47 153 6/14/2025
1.0.40 154 6/14/2025
1.0.38 163 6/14/2025
1.0.37 138 5/9/2025
1.0.36 81 5/9/2025
1.0.35 81 5/9/2025
1.0.34 82 5/9/2025
1.0.33 146 5/8/2025
1.0.32 146 5/8/2025
1.0.31 146 5/1/2025
1.0.30 152 5/1/2025
1.0.29 151 5/1/2025
1.0.28 150 4/30/2025
1.0.26 147 4/30/2025
1.0.25 146 4/30/2025
1.0.24 144 4/30/2025
1.0.23 152 4/30/2025
1.0.22 150 4/30/2025
1.0.21 142 4/30/2025
1.0.20 146 4/30/2025
1.0.19 142 4/29/2025
1.0.18 159 4/29/2025
1.0.17 156 4/28/2025
1.0.16 159 4/27/2025
1.0.15 166 4/27/2025
1.0.14 159 4/27/2025
1.0.13 157 4/27/2025
1.0.12 155 4/27/2025
1.0.11 152 4/27/2025
1.0.9 160 4/27/2025
1.0.7 161 4/27/2025
1.0.1 152 4/27/2025
1.0.0 159 4/27/2025
0.0.6 247 4/19/2025
0.0.5 169 4/19/2025