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
Meanwhile the real function call requires end-user to annotate given method name with _
for example, following code, called in rust by something along the lines of my_rust_class.bind().my_virtual_method()
extendsMyRustClassclass_nameGdscriptClassfuncmy_virtual_method() ->void:
print("I am never called!")
func_my_virtual_method() ->void:
print("hello from gdscript!")
Will output "hello from gdscript".
Excepted behavior: correct names of given methods in docs and editor's autocomplete. Not sure about get_method_list tho
The text was updated successfully, but these errors were encountered:
Yarwin
changed the title
Virtual methods are wrongly marked in docs and for gdscript API
Virtual methods are wrongly marked in docs and for godot's gdscript editor
Oct 11, 2024
Note – this behavior is properly documented. It is just very confusing for end-end-end users 😬
Note2 – I'm not sure if it is something that should be tackled with godot-rust or in upstream due to some limitations. I could catch this edge case in docs at least tho
Thanks! Thats a mistake on our side, I fixed it in #918. Could you maybe check if it works for you too?
A bit of background on method vs _method: there are some known limitations, particularly point 1. From outside Rust, it's not possible to call the virtual function polymorphically -- only the overridden GDScript method.
I was considering to eventually add something like #[func(virtual_pub)] (better naming), which would register the polymorphic version as my_virtual_method. It might even be possible to do that for all methods, but maybe registering an extra non-virtual method isn't necessary in most cases.
Given some virtual method
It will display in Godot's internal docs as
and in editor as
Meanwhile the real function call requires end-user to annotate given method name with
_
for example, following code, called in rust by something along the lines of
my_rust_class.bind().my_virtual_method()
Will output "hello from gdscript".
Excepted behavior: correct names of given methods in docs and editor's autocomplete. Not sure about get_method_list tho
The text was updated successfully, but these errors were encountered: