mirror of https://github.com/axmolengine/axmol.git
Fix to ensure Component::onEnter() is called (#867)
* Committing genbindings changes * Ensure that Component::onEnter() is called if component is added after parent onEnter has been called. * Code style
This commit is contained in:
parent
f8c3d95176
commit
5c1b2d4f16
|
@ -1954,7 +1954,11 @@ bool Node::addComponent(Component* component)
|
|||
// should enable schedule update, then all components can receive this call back
|
||||
scheduleUpdate();
|
||||
|
||||
return _componentContainer->add(component);
|
||||
const auto added = _componentContainer->add(component);
|
||||
if (added && _running)
|
||||
component->onEnter();
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
bool Node::removeComponent(std::string_view name)
|
||||
|
|
Loading…
Reference in New Issue