For the complete documentation index, see llms.txt. This page is also available as Markdown.

1. Scene setup

If you prefer a video tutorial, refer to the first minute of Part 2 of our Getting Started series.

One of the first steps in adding coherence to a project is to setup the scene that you want the networking to happen in.

Add a CoherenceBridge

In the top menu: GameObject > coherence > Bridge

A GameObject with a CoherenceBridge component will be created in the scene, that we will refer to as CoherenceBridge or the bridge.

CoherenceBridge manages the connection with coherence's relay (i.e., the Replication Server) and is the centre of many connection-related events.

No particular setup is required now, but feel free to explore the options in its Inspector.

Add a CoherenceLiveQuery

In the top menu: GameObject > coherence > Live Query

A GameObject with a CoherenceLiveQuery component will be created in the scene, that we will refer to as CoherenceLiveQuery or the live query.

A CoherenceLiveQuery defines what part of the world the Client is interested in when requesting data from the Replication Server. When Constrained, it covers limited volume. The Extent property specifies how far it reaches. Anything that is outside the area defined by the LiveQuery will not be synced.

For a big game world, it makes sense to use a small range and parent the LiveQuery to the player character or the camera, so it can move with it. But for now, let's just position it at the centre of the world (unparented), and keep it as Infinite (no spatial constraints).

Add a Connect Dialog

We'll be using coherence's Sample UI since it has everything we need to get kickstarted.

In the top menu: coherence > Hub

Within the Hub, go to the Samples tab. Within UIs you will find the Rooms Sample UI

The imported sample has a demo scene, but what matters to us now is the Room Connection Dialog.prefab, which we can drop on our scene.

This sample uses Unity GUI (UGUI). For input events to be forwarded properly, you'll need at least an EventSystem (GameObject > UI > Event System)

A Connect dialog UI provides an interface for the player to connect to the Replication Server, once the game is running. You can create your own connection dialog, but we provide a few examples as a quick way to get started and for prototyping. Read more in the section dedicated to Sample UIs.

This is how your scene should look like


Last updated

Was this helpful?