Nenofite.GodotGrabber 1.2.7

dotnet add package Nenofite.GodotGrabber --version 1.2.7
NuGet\Install-Package Nenofite.GodotGrabber -Version 1.2.7
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="Nenofite.GodotGrabber" Version="1.2.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Nenofite.GodotGrabber --version 1.2.7
#r "nuget: Nenofite.GodotGrabber, 1.2.7"
#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.
// Install Nenofite.GodotGrabber as a Cake Addin
#addin nuget:?package=Nenofite.GodotGrabber&version=1.2.7

// Install Nenofite.GodotGrabber as a Cake Tool
#tool nuget:?package=Nenofite.GodotGrabber&version=1.2.7

Godot Grabber

Godot Grabber is a source generator for Godot C# scripts. It reduces boilerplate when getting nodes within a script:

partial class MyNode : Node
{
    // This will get a scene-unique node named "%CharacterSprite"
    [Grab]
    Sprite2D CharacterSprite;

    // This will get a node at path "Other/Sprite"
    [Grab("Other/Sprite")]
    Sprite2D EnemySprite;

    public override void _Ready()
    {
        // Call within _Ready() to actually get the above nodes
        GrabNodes();
    }
}

The generator makes a private method GrabNodes to set the values of each field marked with [Grab]. Because it's generated at compile time, no runtime reflection is performed. This keeps things lightweight.

Scene unique nodes

The default and recommended behavior is to use scene unique nodes that exactly match the name of the C# field. These nodes are marked with a % in the Godot editor.

Because the nodes are scene unique, you can move them within the hierarchy of the scene without changing the binding in C#.

Custom paths

If you'd like to specify a custom path instead, pass a path to the attribute:

[Grab("Other/Sprite")]
Sprite2D EnemySprite;

The path string is passed directly to Node.GetNode(), so it supports the usual NodePath syntax.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.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.2.7 155 1/24/2024
1.2.5 117 1/19/2024
1.2.1 108 1/17/2024
1.2.0 63 1/17/2024
1.1.0 73 1/17/2024