Ouse.Godot.DependencyInjection 1.0.0

dotnet add package Ouse.Godot.DependencyInjection --version 1.0.0
                    
NuGet\Install-Package Ouse.Godot.DependencyInjection -Version 1.0.0
                    
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="Ouse.Godot.DependencyInjection" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ouse.Godot.DependencyInjection" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ouse.Godot.DependencyInjection" />
                    
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 Ouse.Godot.DependencyInjection --version 1.0.0
                    
#r "nuget: Ouse.Godot.DependencyInjection, 1.0.0"
                    
#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 Ouse.Godot.DependencyInjection@1.0.0
                    
#: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=Ouse.Godot.DependencyInjection&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ouse.Godot.DependencyInjection&version=1.0.0
                    
Install as a Cake Tool

Ouse.Godot.DependencyInjection

Scene-tree cascading DI for Godot 4 (.NET), built on Microsoft.Extensions.DependencyInjection.

API style mirrors Chickensoft.AutoInject (attributes + _Notification), but the container is MSDI with cascading IServiceProvider scopes.

dotnet add package Ouse.Godot.DependencyInjection --version 1.0.0

Full docs: build with DocFX (docfx docfx.json) or read docs/v1.0/ in the repo.

When referencing the project directly (not NuGet), also add the generator and analyzer:

<ProjectReference Include="...\Ouse.Godot.DependencyInjection.csproj" />
<ProjectReference Include="...\Ouse.Godot.DependencyInjection.Generators.csproj"
                  OutputItemType="Analyzer"
                  ReferenceOutputAssembly="false" />
<ProjectReference Include="...\Ouse.Godot.DependencyInjection.Analyzers.csproj"
                  OutputItemType="Analyzer"
                  ReferenceOutputAssembly="false" />

Usage

Every participating node must forward notifications (same requirement as AutoInject):

public override void _Notification(int what) => this.NotifyDi(what);

The analyzer OGD020 errors if this line is missing; Visual Studio / Rider can apply the code fix “Add _Notification ⇒ NotifyDi(what)”.

Service host (Provider)

[ServiceHost(InheritParent = false)] // Autoload root
public partial class GameServices : Node
{
    public override void _Notification(int what) => this.NotifyDi(what);

    private void ConfigureServices(IServiceCollection services)
    {
        services.AddSingleton<IAudio, GodotAudioService>();
    }
}

Inject (Dependent)

public partial class Spawner : Node
{
    public override void _Notification(int what) => this.NotifyDi(what);

    [Inject] public ILevelConfig Config { get; private set; } = null!;
    [Inject] public IAudio Audio { get; private set; } = null!;

    private void OnInjected()
    {
        Audio.Play("spawn");
    }
}

AutoNode (scene child binding)

Chickensoft AutoConnect / [Node] analogue — bind properties to child nodes by name or path (Ready, before [Inject]):

[AutoNode]              // child named "Spawner", or unique name %Spawner
public Spawner Spawner { get; private set; } = null!;

[AutoNode("Player")]    // explicit path
public Player Player { get; private set; } = null!;

[AutoNode("Player/Weapon")]
public Weapon Weapon { get; private set; } = null!;
Chickensoft This library
Provider + Provide() [ServiceHost] + ConfigureServices
[Dependency] + DependOn<T>() [Inject] properties
[Node] / AutoConnect [AutoNode]
Notify / OnResolved NotifyDi / OnInjected

No Node subclasses are shipped in the package DLL — stubs are source-generated into your game assembly (required for Godot C# hot-reload).

Hot reload: after changing ConfigureServices registrations, restart the editor/game so hosts rebuild.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0 144 8/14/2026

Initial 1.0.0 release: [ServiceHost], [Inject], [AutoNode], NotifyDi, cascading MSDI scopes, OGD020 analyzer + code fix.