Trigger OnValueSynced when not connected

Coherence is obviously a multiplayer framework, but many games will want to support solo play as well I imagine. Being able to use the same network objects in both offline and networked environments would be ideal.

When offline, OnValueSynced will not fire (nothing is synced), but a lot of network functionality will obviously be based off of this attribute. This means that the OnValueSynced method will basically need to be duplicated and slightly modified to accommodate for an offline environment when the synced field will not be updated via the network.

I’m not sure the absolute best way to achieve this, but my thought is if Coherence detects no connection, when a script modifies a synced property, it automatically fires the OnValueSynced method. This is essentially simulating sending data over the network and receiving it without actually doing that.

Another thought is that if modifying the OnValueSynced attribute to support this would not make much sense, maybe adding another attribute that would do this such as [SyncWhileOffline] or something like that.

1 Like

Thanks for the suggestion @Neodamus , I’ll add it to our tickets.