Closed pupil1337 closed 6 months ago
Thanks for the report!
All classes that use GDCLASS()
are supposed to define their own static void _bind_methods()
- it weren't for the parent class, there would have been a compilation error. I'll see if I can come up with a way for their to be a compilation error when _bind_methods()
is omitted, even when there is a parent class involved.
I just posted PR https://github.com/godotengine/godot-cpp/pull/1448 that attempts to make it a compile-time error if a class doesn't define its own _bind_methods()
function.
I just posted PR #1448 that attempts to make it a compile-time error if a class doesn't define its own
_bind_methods()
function.
Thank you. I think _ready() _input()
called not affected by the definition of _bind_methods()
or not. _bind_methods()
is only to write ClassDB::bind_method()
or ADD_PROPERTY()
for editor. When declare virtual void _ready() override;
in my class, it must can call from godot. declare the _bind_methods()
function is optional(dont compilation error). Please check if my idea is reasonable.
declare the _bind_methods() function is optional(dont compilation error).
It isn't intended to be optional - you're supposed to always have a _bind_methods()
, even if it's empty.
And, if you were defining a class that descended from a native type, not implementing _bind_methods()
would already have been a compilation error. My PR is only making it also be a compilation error when defining a class that descends from another extension class (rather than from a native class).
It isn't intended to be optional - you're supposed to always have a , even if it's empty.
_bind_methods()
And, if you were defining a class that descended from a native type, not implementing would already have been a compilation error. My PR is only making it also be a compilation error when defining a class that descends from another extension class (rather than from a native class).
_bind_methods()
Ok, I understand now
Godot version
4.3.dev(e5b4ef8)
godot-cpp version
4.3.dev(b021245)
System information
win11
Issue description
This may be a problem, and I'm not sure. For safety reasons, I reported it.
issue:
When Base class not declare
_ready()
, and Derive class declare_ready()
but not declare_bind_methods()
, the virtual func_ready()
in Derive class will not called.register
Base
andDerive
, and useDerive
as root node in engine, run the game:Derive
will not call_ready()
Causes:
Steps to reproduce
Look Issue description.
Minimal reproduction project
N/A