소스 검색

Merge pull request #73806 from Faless/mp/4.x_fix_prop_config_from_code

[MP] Fix replication config not updating sync/spawn props from code.
Rémi Verschelde 2 년 전
부모
커밋
a386b79983
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      modules/multiplayer/scene_replication_config.cpp

+ 12 - 0
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()) {
 	if (p_index < 0 || p_index == properties.size()) {
 		properties.push_back(ReplicationProperty(p_path));
 		properties.push_back(ReplicationProperty(p_path));
+		sync_props.push_back(p_path);
+		spawn_props.push_back(p_path);
 		return;
 		return;
 	}
 	}
 
 
@@ -126,6 +128,16 @@ void SceneReplicationConfig::add_property(const NodePath &p_path, int p_index) {
 		c++;
 		c++;
 	}
 	}
 	properties.insert_before(I, ReplicationProperty(p_path));
 	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) {
 void SceneReplicationConfig::remove_property(const NodePath &p_path) {