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
{{ message }}
Repository navigation
cast_to and virtual function confusing behavior #910
Summary: I ran into confusion implementing my own virtual function in a GDExtension class and overwritting it in GDScript. There may be a fix by properly binding the virtual method. For any solution an example could be added to the test/src/example.h
Minimal Test Program: Only showing the relevant part of the class, not the boilerplate for GDExtension.
Problem: If I overwrite the update method in GDScript, then future calls directly to update in GDScript call the correct update. The problem is when calling update_all_children in GDScript in which case all children will call the update you see defined in test.cpp.
Temporary Fix: Replace ->update() with `->call("update"). This produces the correct output for all children.
Solution: I think the ->update() syntax should call the overridden version in GDScript, not the cpp implementation. Perhaps this is how it works if using GDVIRTUAL0 or bind_virtual_method would. There isn't currenty an example for this, and I couldn't get it to compile on my own. Either way there isn't currently an example for defining and using your own virtual method.
Activity