You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extendsNodeconstGlobalDotnetScript=preload("res://GlobalDotnetScript.cs");
func_ready() ->void:
GlobalDotnetScript.SayHi(1,2,3,4,5,6);
varnode=GlobalDotnetScript.new();
add_child(node);
node.SayHello(1,2,3,4,5,6)
# Parse Error: Too few arguments for "SayHello()" call. Expected at least 6 but received 0.node.SayHello();
# Parse Error: Too few arguments for "SayHi()" call. Expected at least 6 but received 0.GlobalDotnetScript.SayHi();
I think that this is not a regression, since GDScript was not previously aware of the other languages. Probably the problem is that the Godot API (MethodInfo/get_method_list()) does not support method overloads (only built-in constructors and operators). So this is probably a question for the @godotengine/dotnet team.
I think that if you use one method with optional arguments instead of two overloads, it will work.
Giving my 2 cents because I dove into the C# binding recently:
#85703 was implemented by calling get_method_info(string) which only does a lookup by name, disregarding any kind of parameter count checks.
Technically speaking MethodInfo contains the argument count information which could be used for looking up the correct overload by name and parameter count.
Please note that same argument count overloading by type will not work as that is currently not handled by the C# binding.
Tested versions
v4.3.dev5.mono.official.89f70e98d
System information
Windows 10.0.22000 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.5123) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)
Issue description
It runs correctly in version 4.2.1, but errors occur starting from version 4.3.
If this segment of source code is removed, runs normally.
godot/modules/gdscript/gdscript_analyzer.cpp
Line 3307 in 7d151c8
CSharp:
GDScript:
Steps to reproduce
Minimal reproduction project (MRP)
csharp-test-method.zip
The text was updated successfully, but these errors were encountered: