Syncing big data
Using fragmented channels to synchronize data that wouldn't usually fit in a packet.
Synchronizing entities with byte[]
or string
bindings, or sending commands with byte[]
or string
arguments allows you to sync large amounts of custom data, but if an entity update, or a single command, is too large to fit inside a single packet (where default MTU is 1280 bytes), then the entity update or the command will never be synchronized. To solve this problem, and be able to sync data of practically any size, you can use fragmented channels for synchronization of entities or commands.
Because of the implementation nature of fragmented channels, sending considerably large data over a fragmented channel will delay subsequent updates and commands (even of different entities) sent over the same fragmented channel until the original data is fully transferred. For this reason, it is recommended to separate latency-sensitive bindings (such as player position) and big-data bindings by dividing them into different CoherenceSyncs.
Syncing big data over entity bindings
In the Advanced Settings of the CoherenceSync, you can change the Synchronization Channel of an entity. Choosing the Fragmented channel will synchronize creation, deletion, and all binding updates of the entity over the Fragmented channel, allowing you to sync data of any size.
Use Fragmented channels only for entities that you are sure will have large data to synchronize, because, as noted before, those entities could potentially experience increased latency.

Syncing big data over commands
You can send commands over the fragmented channel to any entity, no matter if the entity is synchronized over the Fragmented or Default channel. To send a command over the fragmented channel, use the SendCommandOverChannel(...)
and SendCommandToChildrenOverChannel(...)
overloads, passing either Fragmented or FragmentedOrdered channel (for ordered commands) as an argument.
Use Fragmented channels only for commands that you are sure will have large data to send, because, as noted before, those commands could potentially experience increased latency.
var data = new byte[1024 * 1024]; // 1 MB of data
sync.SendCommandOverChannel<Player>(
nameof(Player.SendData),
MessageTarget.AuthorityOnly,
Channel.Fragmented,
data);
Last updated
Was this helpful?