From 680a668e2f13b22927ab035f16327fd2d6a3b1ef Mon Sep 17 00:00:00 2001 From: Nathan Franke Date: Sat, 23 Apr 2022 15:01:01 -0500 Subject: remove child on despawn instead of just queue_delete --- scene/multiplayer/scene_replication_interface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/multiplayer/scene_replication_interface.cpp b/scene/multiplayer/scene_replication_interface.cpp index 0764f136e4..2952512462 100644 --- a/scene/multiplayer/scene_replication_interface.cpp +++ b/scene/multiplayer/scene_replication_interface.cpp @@ -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); ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(!node, ERR_BUG); + if (node->get_parent() != nullptr) { + node->get_parent()->remove_child(node); + } node->queue_delete(); return OK; } -- cgit v1.2.3