GodotGetNode 0.2.2
dotnet add package GodotGetNode --version 0.2.2
NuGet\Install-Package GodotGetNode -Version 0.2.2
<PackageReference Include="GodotGetNode" Version="0.2.2" />
paket add GodotGetNode --version 0.2.2
#r "nuget: GodotGetNode, 0.2.2"
// Install GodotGetNode as a Cake Addin
#addin nuget:?package=GodotGetNode&version=0.2.2
// Install GodotGetNode as a Cake Tool
#tool nuget:?package=GodotGetNode&version=0.2.2
GodotGetNode
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("Player")] CharacterBody2D player;
// Custom syntax to get a node relative to another node!
[GetNode(nameof(player), "Sprite")] Sprite2D sprite;
// .. or a neater, but type unsafe syntax:
[GetNode("{player}/Sprite")] Sprite2D sprite;
public override void _Ready() {
// No more GetNode<Sprite2D>("Player/Sprite") 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!
Compatibility
Actively tested for Godot 4.x
Version | Godot 3.x | Godot 4.x |
---|---|---|
0.1.x | Likely | ✔ |
0.2.x | Untested | ✔ |
All this project does is generate some GetNode<>()
s on TreeEntered
using types and names extracted from your code,
so theoretically it should work on Godot 3.x
The .NET version and features the project is using might block use on 3.x though. If you use 3.x and this project doesn't work, please open up an issue and I will fix it right away!
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(..)
- Example:
- A complete rewrite for cleanliness' sake.
- Allow easier user debugging & Fix "Cannot access a disposed object" in some rare cases
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 | 33 | 6/12/2024 |
0.2.1 | 31 | 6/12/2024 |
0.2.0 | 39 | 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 |