<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_NetworkObject 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_NetworkObject’s UpdateData function in the form of an object, and this data will be received by that same V_NetworkObject on the other clients, and emitted in the OnDataChange event found on the V_NetworkObject’s inspector.
<aside>
⚠️ Data received from a V_NetworkObject 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 V_NetworkObject a list of strings, you need to cast the object emitted by the V_NetworkObject back into a list of strings!
</aside>
Sync Settings
Note: These settings will only appear if a V_InstanceIntegration component is present in the scene. Without these, all components will be non-networked.
Is Networked: Defines whether the state of the component should be synchronised across the players in the instance. If unticked, each player will effectively have their own version of the component. If ticked, the component will be shared across the instanceTransmission Frequency: Determines how often the host will broadcast the state of the component to the other players in the instance. E.G, 1 hz will transmit state once per second, and is nearly always sufficient. Regardless of frequency, the state of the component will be always be transmitted the frame after it is changed locally.Transmission Protocol: The network protocol used to synchronise the state of the component. UDP is faster, though packets are not guaranteed to arrive at their destination. TCP is more reliable, as any failed packets will be resent automatically, though this may trigger TCP rate-throttling limits depending on the players’ network configurations