Frequently asked questions
How to stablish a connection
For a ready-to-use solution, use the Sample UIs accessible from within the coherence Hub. These samples showcase how to connect using Rooms or Worlds, and create connections with a local Replication Server and with a coherence Cloud hosted Replication Server. Otherwise refer to the Getting Started section or Replication Server API documentation.
Can't stablish a connection
Is a Replication Server running?
Is the Replication Server using the same schema as your project?
Ensure you have baked.
For local RS, shut down the the Replication Server and launch it again.
For cloud RS, ensure you have uploaded the schema to the cloud, then retry.
Are you on Windows and have text selected in the Command Prompt that is running the Replication Server?
Press Esc with the Command Prompt having focus to clear any selected text and resume the application.
You can also disable the Quick Edit Mode in Command Prompt's Properties to make it more difficult to accidentally select text. You will then need to select Edit > Mark (or press Ctrl + M) before you can select text.
How to spawn my Player Prefab
There is no specific "instantiate my player prefab" logic built-in. Any script can instantiate it. You can listen to CoherenceBridge's onConnected or onLiveQuerySynced events to do your Instantiate(playerPrefab). No calls to any coherence-specific APIs — just a regular Instantiate.
How to spawn or destroy a Networked Prefab
Spawning is done by simply instantiating a prefab that has a CoherenceSync component on it, by using Unity's Instantiate() API. Same for removing entities, Destroy() the GameObject. Read more about instantiating and destroying.
How to sync a variable
You can sync variables on any component attached to a prefab via CoherenceSync component inspector. Click on the Configure button and the Configure window will open. From there, toggle the variables you want to synchronize. These variables will comform the network state of the entity.
Only variables of the supported types can be synchronized currently.
How to find or iterate through other connected clients
Refer to Client Connections.
How to invoke a method on a client, or on all of them
Refer to Commands.
How to move all connected clients to a new scene together
To make all connected clients move to a new scene, you can create a method that loads the scene and mark it as a Command. Send that command to all targets via MessageTarget.All. See also Scene Management.
How to run a dedicated server for my game
Dedicated Servers in coherence are called Simulators.
How to do client-side prediction
Disable automatic updates on the variables you want predict. Implement your prediction code, and listen for incoming updates by hooking into update callbacks. When the update arrives, you can reconcile the predicted state and the new, incoming sample in a way that fits your game best.
How to create a chat system
To create a simple in-game chat functionality, you can leverage Commands to send strings (or byte arrays) to all connected Clients.
A pre-game chat can also be created by leveraging Lobbies.
Last updated
Was this helpful?

