summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-05 17:03:40 +0200
committerGitHub <noreply@github.com>2022-05-05 17:03:40 +0200
commit88a440826ad197ea5d3a98e8c64946c468fc63cd (patch)
tree432cfff162f6b0890bedf18b95b899f1f32e8004 /scene
parent8fb02635d4cab08601c92340a9c52e754830d58b (diff)
parent680a668e2f13b22927ab035f16327fd2d6a3b1ef (diff)
Merge pull request #60479 from nathanfranke/despawn-remove-child
multiplayer - remove child on despawn instead of just queue_delete
Diffstat (limited to 'scene')
-rw-r--r--scene/multiplayer/scene_replication_interface.cpp3
1 files changed, 3 insertions, 0 deletions
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;
}