A C# wrapped version of G.U.I.D.E, a simple but powerful way to handle input in the Godot Engine.
G.U.I.D.E-CSharp is designed to follow all the normal behavior of G.U.I.D.E, so most of what you do with the wrapper is exactly the same other than using CamelCase instead of snake_case.
// GDScript
GUIDE.enable_mapping_context();
// C#
Guide.EnableMappingContext();
C# Editor resources are handled with a duplicate resource type, denoted by the blood orange color variation and a C# icon.
Anything done directly in the editor, use GUIDE resources as normal.
Anything done in C#, use a GuideCs resource.
GUIDEAction or GUIDEMappingContext.


GUIDEAction or GUIDEMappingContext as an export parameter.

[Export] variables as GuideCs types.
using Godot;
using GuideCs;
public partial class Main : Node
{
[Export] public GuideMappingContext WalkMode;
[Export] public GuideAction move;
}

using Godot;
using GuideCs;
public partial class Main : Node
{
[Export] public GuideMappingContext WalkMode;
[Export] public GuideAction move;
public override void _Ready()
{
Guide.EnableMappingContext(WalkMode);
}
}
If you don’t use [Export] properties and would prefer to load and manage your C# resources through code, you can also do so by using the Utility.CreateWrapper() function to generate wrapped resources:
public Dictionary<string, GuideAction> WrappedActions;
public override void _Ready()
{
Dictionary<string, string> guideActions = new ()
{
{"Jump", "uid://cm76dijjo3wm4"},
{"Shoot", "uid://cki32mfnd6v7k"},
{"walk", "uid://c0quxwokh6bm4"},
};
foreach (var kvp in guideActions)
{
var guideBaseObject = (GodotObject)ResourceLoader.Load<GDScript>(kvp.Value).New();
var wrappedAction = Utility.CreateWrapper<GuideAction>(guideBaseObject);
WrappedActions.TryAdd(kvp.Key, wrappedAction);
}
base._Ready();
}
These examples are NOT the only way, there are much better ways, keeping the code examples more readable was priority here.
GuideResource.ConnectBaseGuideResource()
// or
GuideResource.LoadAndConnectBaseGuideResource()
public partial class Main : Node2D
{
public List<GodotObject> BaseGuideMappingContextsLoaded = [];
public override void _Ready()
{
var wrappedMappingContext = new GuideMappingContext();
wrappedMappingContext.ConnectBaseGuideResource(BaseGuideMappingContextsLoaded[0]);
}
}
public partial class Main : Node2D
{
public List<string> BaseGuideMappingContextPaths = [];
public override void _Ready()
{
var wrappedMappingContext = new GuideMappingContext();
wrappedMappingContext.LoadAndConnectBaseGuideResource(BaseGuideMappingContextPaths[0]);
}
}
public partial class Main : Node2D
{
public override void _Ready()
{
var loadedGuideObject = (GodotObject)ResourceLoader.Load<GDScript>("uid or path").New();
wrappedMappingContext = new GuideMappingContext(loadedGuideObject);
}
}
Note: GuideCs cannot verify the GUIDE object type:
get_class() and is_class() return the Godot inherited class not class_name.GodotObject.