godot
godot copied to clipboard
SceneReplicationConfig adding/removing sync properties through code does not update the targeted sync properties
Godot version
4.0.beta1
System information
Windows 10
Issue description
As one would expect, the new MultiplayerSynchronizer would sync whatever properties you give it; as long as certain conditions are met. The focus of this issue is not related to, if the conditions are correct or not. But when you add/remove new sync properties through code; it simply does not sync them.
The odd thing here is that it syncs perfectly fine, when adding these sync properties from the Editor.
But when keeping the list empty, and adding them through code. They are not synced anymore. One would immediately assume that the node paths are incorrect. However, even when writing ".:position" directly (where we assume that the root_node is a type of Node2D), it still does not work.
This also happens in reverse. If you already have linked properties in the editor, and try to remove them from code. They still sync... Even when they do not show up in the array, when printing the result from get_properties() in SceneReplicationConfig.
I have also tried to multiplayer.object_configuration_remove(), updated the properties through code and then multiplayer.object_configuration_add() the MultiplayerSynchronizer; in order to see if that updated the properties.
Some things of note: (but most likely does not have an influence on this potential issue) The test project assumes one of the clients playing, is the host/server The test project has a dedicated puppet scene and a separate player scene. (puppet is always an external client, and the player is always local)
If there is something I have missed (like a function call or something else) in order to make it work or update the syncing, tell me and this issue will close.
Steps to reproduce
Establish a simple server connection.
Add the local player and client nodes accordingly upon a connection, let them each have a MultiplayerSynchronizer node. (Leave the property list empty)
Set the MultiplayerSynchronizer nodes' authority respectively, according to which client who owns it.
Then link the properties you would like to sync (position, rotation, etc.) through code
MultiplayerSynchronizer.replication_config.add_property("NodePath")
Optionally, you may add controls, so you can see the effect.
Minimal reproduction project
Control the local player with arrow keys. You may also rotate it with "ui_cancel"
The red stick figure with the godot icon is always the local player, and the blue ones are always other clients.
This means that when moving locally, you move the red figure. But for other clients, you appear as the blue figure.