-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C#: Fix signature of generated signal callbacks #67023
C#: Fix signature of generated signal callbacks #67023
Conversation
- Use `long` and `double` types since signals currently only support 64-bit types. - Fix bug for checking if the type name is a class registered in ClassDB.
I guess it can close it fully, the confusing "Method not found" part can be tracked in #35910. Probably also needed for 3.x? |
The ClassDB check should be backported, but I believe Godot 3.x uses 32-bit types for scalar Variants. |
Lines 155 to 156 in ec21ac5
The other vector and poolarray types are 32-bit though. |
Then now I'm wondering why we marshal them as 32-bit types in godot/modules/mono/mono_gd/gd_mono_marshal.cpp Lines 474 to 486 in ec21ac5
But it's likely we don't want to make this type of change in 3.x (see #39629 (comment)). |
That would break compat in 3.x, and I'd prefer not to do that. |
Is this error still a thing on latest Godot 4? My guess is that, as long as the parameter count matches, the method will be called and the Variant will be adapted to the parameter type, similar to the way it works in C++. |
That is correct. But I think the issue is that having a parameter count mismatch and getting a "Method not found" error, while accurate, is kind of vague and may be difficult to understand for users. See, for example, this issue that was recently opened #69519. From the error message, the user thought that there was a bug in Godot because it couldn't find the method even though the method "exists" (the user doesn't see a method with a different signature as a different method). If instead we were using the error that is used in GDScript, the error would be much friendlier since it explains that the issue is that the parameters don't match:
|
GDScript can easily do that because it doesn't allow method overloading. In our case it's harder and it may add overhead. |
It'd most likely add overhead, but maybe we can do it only in Debug. Not sure if it'd be a good idea to print different errors in Release than in Debug though. Either way, I was just trying to explain the issue (#35910), it's not about using the wrong parameter type but about the message being confusing to users when a method does exist but the parameter count does not match. |
long
anddouble
types since signals currently only support 64-bit types.