A utility for the stateful syncing of specific data from your plugin

<aside> ℹ️ You can also transmit custom data to other clients using an InstantMessageHandler, see the InstantMessageHandler page for more information, and to learn how they differ from PluginSyncables

</aside>

The state of ViRSE’s components, such as InfoPoints, Activatables, and Grabbables, as well as player positions, are all synced automatically. It is important to note that only the current state of this data is transmitted. This means you have to manually sync any data that either relates to the history of your world, or isn’t captured by one of ViRSE components

A V_PluginSyncable can be attached to a GameObject, allowing you to sync any custom data you like between all clients in the instance. Data can be passed to the V_PluginSyncable’s UpdateSyncData function in the form of an object, and this data will be received by that same V_PluginSyncable on the other clients, and emitted in the ReceivePluginSyncData event found on the PluginSyncable’s inspector.

<aside> ⚠️ Data received from a PluginSyncable must be cast back into the exact format it was sent in in order for it to be handled in your code. For example, if you pass the PluginSyncable a list of strings, you need to cast the object emitted by the PluginSyncable back into a list of strings!

</aside>

Example

<aside> ℹ️ A common use for PluginSyncables is to handle spawning and despawning GameObjects at runtime. Fortunately, this has already been written for you! You can reuse the P_GameObjectSpawnManager script used in the sample scene. Add this to your own scene, tell it what prefab you want to spawn, and link it to a PluginSyncable to have newly spawned/despawned GameObjects synced across the instance

</aside>