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.
// base.h
class Base : public Node {
GDCLASS(Base, Node)
protected:
static void _bind_methods() {}
};
// derive.h
class Derive : public Base {
GDCLASS(Derive, Base)
public:
virtual void _ready() override {
Base::_ready();
UtilityFunctions::print("Derive::_ready");
}
};
register Base and Derive, and use Derive as root node in engine, run the game:
Derive will not call _ready()
Causes:
// wrapped.hpp
static void initialize_class() {
static bool initialized = false;
if (initialized) {
return;
}
m_inherits::initialize_class();
if (m_class::_get_bind_methods() != m_inherits::_get_bind_methods()) { // derive class not declare _bind_methods() cause issue
_bind_methods();
m_inherits::register_virtuals<m_class, m_inherits>(); // register virtual (_ready,_process,...) in this line
}
initialized = true;
}
Steps to reproduce
Look Issue description.
Minimal reproduction project
N/A
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
BaseandDerive, and useDeriveas root node in engine, run the game:Derivewill not call_ready()Causes:
Steps to reproduce
Look Issue description.
Minimal reproduction project
N/A