GodotGetNode 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package GodotGetNode --version 0.2.0
NuGet\Install-Package GodotGetNode -Version 0.2.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="GodotGetNode" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GodotGetNode --version 0.2.0
#r "nuget: GodotGetNode, 0.2.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.
// Install GodotGetNode as a Cake Addin
#addin nuget:?package=GodotGetNode&version=0.2.0

// Install GodotGetNode as a Cake Tool
#tool nuget:?package=GodotGetNode&version=0.2.0

GodotGetNode

GitHub Issues

A production-ready Godot 4.x source generator to help you get your nodes!

Example

using Godot;

public partial class MyNode : Node2D {
	// Specify the name of the node
	[GetNode("CoolSprite")] Sprite2D sprite;
    
	// Guess the name based on the default type name ("VBoxContainer" in this case)
	[GetNode] VBoxContainer container;

	// Custom syntax to get a node relative to another node!
	[GetNode(nameof(container), "PanelContainer/Label"] Label relative2;
	// .. or a neater, but type unsafe syntax:
	[GetNode("{container}/PanelContainer/Label"] Label relative1;
    
	public override void _Ready() {
		// No more GetNode<Type>("Name") over here!
	}
}

Note

This repo might seem inactive, but this project works just fine.

I don't update this repo often as it doesn't need any updates, but I've been using it myself in my own Godot projects for about a year now as of the time I'm writing this.

If you do encounter any issues, please open up an issue or a PR on the repository!

Hide inlays in your IDE for the best experience

Compatibility

Actively tested for Godot 4.x

Version Godot 3.x Godot 4.x
0.1.x Likely
0.2.x Untested

Roadmap

  • Optionally allow specifying a variable name to the left of the node path string
    • Example: [GetNode(container, "PanelContainer/Label"] Label relativeToContainer;
    • -- There's no neat way of doing this, because of C# its required to use nameof(..)
  • A complete rewrite for cleanliness' sake.
    • Allow easier user debugging & Fix "Cannot access a disposed object" in some rare cases
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.2.2 66 6/12/2024
0.2.1 56 6/12/2024
0.2.0 63 6/12/2024
0.1.3 198 7/24/2023
0.1.2-alpha6 267 7/24/2023
0.1.2-alpha5 216 7/24/2023
0.1.2-alpha4 224 7/23/2023
0.1.2-alpha3 160 7/23/2023
0.1.2-alpha2 252 7/23/2023
0.1.2-alpha1 196 7/23/2023
0.1.1 138 7/23/2023
0.1.0 120 7/23/2023