Shaka.Godot.Actions
0.0.6
dotnet add package Shaka.Godot.Actions --version 0.0.6
NuGet\Install-Package Shaka.Godot.Actions -Version 0.0.6
<PackageReference Include="Shaka.Godot.Actions" Version="0.0.6" />
<PackageVersion Include="Shaka.Godot.Actions" Version="0.0.6" />
<PackageReference Include="Shaka.Godot.Actions" />
paket add Shaka.Godot.Actions --version 0.0.6
#r "nuget: Shaka.Godot.Actions, 0.0.6"
#:package Shaka.Godot.Actions@0.0.6
#addin nuget:?package=Shaka.Godot.Actions&version=0.0.6
#tool nuget:?package=Shaka.Godot.Actions&version=0.0.6
π― Shaka.Godot.OnReady
A C# Source Generator for Godot 4 .NET that automatically turns your input actions into compile-time safe static StringName.
β¨ Benefits:
- π± IDE Autocompletion for input actions.
- π Compile-time safety: Your project wonβt build if you rename actions in Godot but forget to update them in code.
- β‘ No runtime reflection β all generated at build time.
Example of generated code:
namespace MyGame;
internal static partial class Actions
{
internal static Godot.StringName Quit = "quit";
}
π Features
- π‘ Compile-time safety for all input actions.
- π Clean, readable generated code.
- π LSP/IDE autocompletion in C# editors.
- π§© Supports both custom and built-in Godot actions.
- π§ Configurable namespace support.
- π Automatically reads
project.godot
to generate constants.
π¦ Installation
Add it to your Godot project via NuGet.
Since this is a source generator, make sure to include the PrivateAssets
and IncludeAssets
properties:
<PackageReference Include="Shaka.Godot.Actions" Version="x.x.x">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
π Check the NuGet package page for the latest version.
The generator will automatically read your project.godot
file and generate a globally available static Actions
class.
πΉ Usage
π― Custom Actions
If you define a custom action in Godot (e.g., quit
), you can access it with MyGame.Actions.Quit
:
public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed(MyGame.Actions.Quit))
{
Quit();
}
}
β Built-in Godot Actions
Godotβs default input actions are included under MyGame.Actions.Builtin.UIAccept
:
public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed(MyGame.Actions.Builtin.UIAccept))
{
AcceptGift();
}
}
β Configuration
Actions Namespace
π Default
By default, the generated Actions
class is placed in the root namespace defined in your .csproj
:
<PropertyGroup>
<RootNamespace>MyGame</RootNamespace>
</PropertyGroup>
This means the class is accessible via:
MyGame.Actions
If no root namespace is defined, the namespace will default to the assembly name β typically your project name.
β Custom Namespace
If you donβt want the Actions
class to be in the default namespace, override it by adding the SGActionsNamespace
property:
<PropertyGroup>
<SGActionsNamespace>MyActions</SGActionsNamespace>
</PropertyGroup>
The class will then be accessible via:
MyActions.Actions
π‘ Tip: This is useful if you want to group input actions into a dedicated namespace to avoid cluttering your main game namespace.
π€ Contributing
Pull requests are welcome!
If you have ideas for new features, bug fixes, or improvements, feel free to open an issue or PR.
π License
This project is licensed under the MIT License β see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.CodeAnalysis.CSharp (>= 4.11.0)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.11.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.