summaryrefslogtreecommitdiff
path: root/scene/multiplayer/scene_replication_interface.cpp
diff options
context:
space:
mode:
authorNathan Franke <me@nathan.sh>2022-04-23 15:01:01 -0500
committerNathan Franke <me@nathan.sh>2022-05-05 08:50:21 -0500
commit680a668e2f13b22927ab035f16327fd2d6a3b1ef (patch)
treec87a8f6aec543885c00aa28cfa365604e159dd5c /scene/multiplayer/scene_replication_interface.cpp
parentccef98441e0c6869876b4b075cb27e694e3b9ed3 (diff)
remove child on despawn instead of just queue_delete
Diffstat (limited to 'scene/multiplayer/scene_replication_interface.cpp')
-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;
}