Browse Source

Merge pull request #62144 from Faless/mp/4.x_replication_config_setter

[Net] Fix SceneReplicationConfig setter.
Fabio Alessandrelli 3 years ago
parent
commit
7320871ffa
1 changed files with 10 additions and 2 deletions
  1. 10 2
      scene/resources/scene_replication_config.cpp

+ 10 - 2
scene/resources/scene_replication_config.cpp

@@ -52,11 +52,19 @@ bool SceneReplicationConfig::_set(const StringName &p_name, const Variant &p_val
 		ReplicationProperty &prop = properties[idx];
 		ReplicationProperty &prop = properties[idx];
 		if (what == "sync") {
 		if (what == "sync") {
 			prop.sync = p_value;
 			prop.sync = p_value;
-			sync_props.push_back(prop.name);
+			if (prop.sync) {
+				sync_props.push_back(prop.name);
+			} else {
+				sync_props.erase(prop.name);
+			}
 			return true;
 			return true;
 		} else if (what == "spawn") {
 		} else if (what == "spawn") {
 			prop.spawn = p_value;
 			prop.spawn = p_value;
-			spawn_props.push_back(prop.name);
+			if (prop.spawn) {
+				spawn_props.push_back(prop.name);
+			} else {
+				spawn_props.erase(prop.name);
+			}
 			return true;
 			return true;
 		}
 		}
 	}
 	}