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:
RH 2022-09-27 19:32:04 +10:00 committed by GitHub
parent f8c3d95176
commit 5c1b2d4f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1954,7 +1954,11 @@ bool Node::addComponent(Component* component)
// should enable schedule update, then all components can receive this call back // should enable schedule update, then all components can receive this call back
scheduleUpdate(); 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) bool Node::removeComponent(std::string_view name)