diff options
author | Nathan Franke <me@nathan.sh> | 2022-04-23 15:01:01 -0500 |
---|---|---|
committer | Nathan Franke <me@nathan.sh> | 2022-05-05 08:50:21 -0500 |
commit | 680a668e2f13b22927ab035f16327fd2d6a3b1ef (patch) | |
tree | c87a8f6aec543885c00aa28cfa365604e159dd5c /scene/multiplayer/scene_replication_interface.cpp | |
parent | ccef98441e0c6869876b4b075cb27e694e3b9ed3 (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.cpp | 3 |
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; } |