Hello!

In Godot 3.x it was possible to override C++ methods introduced by ClassDB::bind_method(....). And it worked perfectly fine.

I've just ported my project to Godot 4.0.1. And it says "The method ... overrides a method from a native class ... . This won't be called by the engine and may not work as expected.". So it refuses to override C++ methods in version 4 at least if ClassDB::bind_method() is used.

I'd appreciate any help! Thank you!

  • z80 replied to this.

    z80
    NVM, it looks like I've found the solution!

    In the header file instead of just declaring a method I now need two lines:

    bool deserialize( const Dictionary & data );
    GDVIRTUAL1R(bool, deserialize, Dictionary);

    And in the source file instead of ClassDB::bind_method() I need

    GDVIRTUAL_BIND(deserialize, "data");

    And it produces a nice looking virtual method in the documentation:

    But what a pain it is going to be to go through all the sources in the module, find, and edit every single method which is overridden in GD-script...