Merge pull request #60479 from nathanfranke/despawn-remove-child

multiplayer - remove child on despawn instead of just queue_delete
This commit is contained in:
Rémi Verschelde 2022-05-05 17:03:40 +02:00 committed by GitHub
commit 88a440826a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -309,6 +309,9 @@ Error SceneReplicationInterface::on_despawn_receive(int p_from, const uint8_t *p
Error err = rep_state->peer_del_remote(p_from, net_id, &node); Error err = rep_state->peer_del_remote(p_from, net_id, &node);
ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(err != OK, err);
ERR_FAIL_COND_V(!node, ERR_BUG); ERR_FAIL_COND_V(!node, ERR_BUG);
if (node->get_parent() != nullptr) {
node->get_parent()->remove_child(node);
}
node->queue_delete(); node->queue_delete();
return OK; return OK;
} }