Configuring persistence

CoherenceSync configuration

The CoherenceSync editor interface allows us to define the Lifetime of a networked object. The following options are available:

  • Session Based. No persistence. The entity will disappear when the client or simulator disconnects.

  • Persistent. The entity will remain on the server until a simulating client deletes it.

Persistence UUID

Persistent objects need to be identified so that the system can know how to treat duplicate persistent objects.

Manually assigning a UUID means that each instance of this persistent object prefab is considered the same object regardless of where on the network it is instantiated. So, for example, if two clients instantiate the same prefab object with the same persistence UUID then only one is considered official and the other is replaced by the replication server.

The CoherenceUUID behaviour is used to uniquely identify a prefab.

It has several functions: you can Generate new ID for your object, and you can set auto-generate UUID on the scene to true, so each time object will receive a new ID.

Auto-generate UUID in scene is not working for persistent objects.

Deleting a persistent object

A persistent object can be deleted only by the client or simulator that has authority over it. For indirect remote deletion, see the section about network commands.

Deleting a persistent object is done the same as with any network object - by destroying its GameObject.

Destroy(coherenceSync.gameObject);

Last updated