From 45e8fa10c1168a5a9b17f8aeb2134b8121abc6d0 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sun, 3 Mar 2024 11:13:00 +0100 Subject: [PATCH] [MP] Fix replication config reload error Override the `reset_state` method to properly handle reloading the resource from disk. --- modules/multiplayer/scene_replication_config.cpp | 8 ++++++++ modules/multiplayer/scene_replication_config.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/modules/multiplayer/scene_replication_config.cpp b/modules/multiplayer/scene_replication_config.cpp index 836fa1014db..733540a0e42 100644 --- a/modules/multiplayer/scene_replication_config.cpp +++ b/modules/multiplayer/scene_replication_config.cpp @@ -103,6 +103,14 @@ void SceneReplicationConfig::_get_property_list(List *p_list) cons } } +void SceneReplicationConfig::reset_state() { + dirty = false; + properties.clear(); + sync_props.clear(); + spawn_props.clear(); + watch_props.clear(); +} + TypedArray SceneReplicationConfig::get_properties() const { TypedArray paths; for (const ReplicationProperty &prop : properties) { diff --git a/modules/multiplayer/scene_replication_config.h b/modules/multiplayer/scene_replication_config.h index 3f870ba2d83..969a23d788f 100644 --- a/modules/multiplayer/scene_replication_config.h +++ b/modules/multiplayer/scene_replication_config.h @@ -79,6 +79,8 @@ protected: void _get_property_list(List *p_list) const; public: + virtual void reset_state() override; // Required since we use variable amount of properties. + TypedArray get_properties() const; void add_property(const NodePath &p_path, int p_index = -1);