diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-02-23 10:02:19 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-02-23 10:03:19 +0100 |
commit | 72f5bbde82013f783d705a1d68b2126375e0f1c7 (patch) | |
tree | 956533c684cb4c6eead68268e361f8631f4744ec | |
parent | 19c9fd6926b958016d562e3b2e93b0e9480300f5 (diff) |
[MP] Fix replication config not updating sync/spawn props from code.
-rw-r--r-- | modules/multiplayer/scene_replication_config.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/multiplayer/scene_replication_config.cpp b/modules/multiplayer/scene_replication_config.cpp index c8621e7357..f8006228de 100644 --- a/modules/multiplayer/scene_replication_config.cpp +++ b/modules/multiplayer/scene_replication_config.cpp @@ -114,6 +114,8 @@ void SceneReplicationConfig::add_property(const NodePath &p_path, int p_index) { if (p_index < 0 || p_index == properties.size()) { properties.push_back(ReplicationProperty(p_path)); + sync_props.push_back(p_path); + spawn_props.push_back(p_path); return; } @@ -126,6 +128,16 @@ void SceneReplicationConfig::add_property(const NodePath &p_path, int p_index) { c++; } properties.insert_before(I, ReplicationProperty(p_path)); + sync_props.clear(); + spawn_props.clear(); + for (const ReplicationProperty &prop : properties) { + if (prop.sync) { + sync_props.push_back(p_path); + } + if (prop.spawn) { + spawn_props.push_back(p_path); + } + } } void SceneReplicationConfig::remove_property(const NodePath &p_path) { |