Closed Mastermori closed 1 year ago
Duplicate of #74325, this is by design, and a pr is open to indicate and manage this for the editor
Oh, sorry I didn't find that while looking for existing issues. So there is no way of syncing any "object type properties", does that mean you cannot sync any type of object that isn't a primitive value? Would I need to sync every single primitive value of the resource individually then?
No problem!
Or use RPC, but generally transferring complex data isn't what the synchronization API is for, it's for compact data, you can synchronize arrays and dictionaries, if they are small enough
For other data the time when they are changed are quite clear, like when changing the player state or similar, and not vert regular which is when synchronization is helpful, and can be sent with RPC calls instead, or encoded
Ok, thank you for the quick help :) Closing this, as it adds nothing new to the duplicate mentioned above.
Godot version
4.0.1stable
System information
Windows 11
Issue description
The new MultiplayerSynchronizer node does not sync resources. It never updates them, neither on spawn, nor on sync. Using the same Synchronizer to sync other properties (such as Vectors or ints) works fine. This is pretty major as it makes using the MultiplayerSpawner to spawn a node which needs to have a resource set on spawn (in my case I want to sync a custom PlayerStats resource which contains _maxhealth, which is used in _Player.ready()), as you can't use the Spawner for it then, because you cannot add custom spawn synchronization without a MultiplayerSynchronizer.
Steps to reproduce
Assume a tester node: with a script:
As you can see a resource (Texture2D) is exported so that it can be synced by a MultiplayerSynchronizer. Now we add it to the Synchronizer of the Tester: We add the net code from the official blogpost to a simple UI.
Together with a Container to spawn the Tester in (to test if they are synced on spawn), also with the code from that same blogpost:
Now running the project and connecting to clients, we can use the remote debug tool (in the scene tree) to look at the resource at runtime. Host: Client:
Pressing Enter changes the resource on the server but not on the client.
Minimal reproduction project
MultiplayerSynchronizerBug.zip