godot
godot copied to clipboard
C# signal callbacks don't work when callbacks are extension methods
Godot version
4.0 Beta 3
System information
Windows 11
Issue description
In C#, signals can be used similar to how Events are used.
However, when using functions that are extension methods:
then I get an error:
It seems to assume the first argument as actual argument, rather than the method owner. With normal C# events this is possible.
Steps to reproduce
- create an extension method for some object
- connect that method to a signal without parameters
- trigger signal
Minimal reproduction project
I think this is easy enough to reproduce in an empty project.
Has this issue been solved? It seems that I can't reproduce the problem.
Where
public class Button2{
}
static class Helper {
public static void Press(this Button2 self) {
GD.Print("Button2 Pressed.");
}
}
godot version: commit e29b982dbf06fb7bb32257642687df5093d7327c dotnet version: 6.0.400
I can reproduce it in beta 3 but not in beta 4, so it seems like it was fixed by https://github.com/godotengine/godot/pull/67987.