diff --git a/src/SimulationRunner.cc b/src/SimulationRunner.cc index 29c24228a8..1cb022ffae 100644 --- a/src/SimulationRunner.cc +++ b/src/SimulationRunner.cc @@ -914,6 +914,17 @@ void SimulationRunner::Step(const UpdateInfo &_info) GZ_PROFILE("SimulationRunner::Step"); this->currentInfo = _info; + // The Run method does not check for entity creation each iteration + // on network secondaries, so check here to ensure that performers + // have parents assigned. + if (this->networkMgr && this->networkMgr->IsSecondary()) + { + if (this->createEntities) + { + this->CreateEntities(); + } + } + // Process new ECM state information, typically sent from the GUI after // a change was made to the GUI's ECM. this->ProcessNewWorldControlState(); diff --git a/src/network/NetworkManagerSecondary.cc b/src/network/NetworkManagerSecondary.cc index 8c34ce343c..2d836ef52a 100644 --- a/src/network/NetworkManagerSecondary.cc +++ b/src/network/NetworkManagerSecondary.cc @@ -130,7 +130,10 @@ void NetworkManagerSecondary::OnStep( { auto parent = this->dataPtr->ecm->Component(entityId); - this->dataPtr->ecm->RequestRemoveEntity(parent->Data()); + if (parent != nullptr) + { + this->dataPtr->ecm->RequestRemoveEntity(parent->Data()); + } if (this->performers.find(entityId) != this->performers.end()) {