# 1. Scene setup

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

### Video tutorial

The topics of this page are covered in the first minute of this video:

{% embed url="<https://www.youtube.com/watch?v=kyUSiBpZ2Bc>" %}

## Step by step

Preparing a scene for network synchronization requires to add three fundamental objects:

### **1. Add a CoherenceBridge**

In the top menu: *coherence > Scene Setup > Create CoherenceBridge*

A GameObject with a `CoherenceBridge` script will be created.

<figure><img src="https://content.gitbook.com/content/QLuEkuU7DLr3jX7gVtzJ/blobs/S31AVUP66megXZqbvISy/Bridge.png" alt="" width="375"><figcaption></figcaption></figure>

This object manages the connection with coherence's relay, the [Replication Server](https://docs.coherence.io/1.4/manual/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.

### **2. Add a LiveQuery**

In the top menu: *coherence > Scene Setup > Create LiveQuery*

A GameObject with a `LiveQuery` script will be created.

<figure><img src="https://content.gitbook.com/content/QLuEkuU7DLr3jX7gVtzJ/blobs/Gi0ypCYvchaSLsoRiikI/LiveQuery.png" alt="" width="375"><figcaption></figcaption></figure>

A [LiveQuery](https://docs.coherence.io/1.4/manual/components/coherence-live-query) 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 create a LiveQuery, position it at the centre of the world, and keep it as **Infinite** (no spatial constraints).

{% hint style="warning" %}
While LiveQueries are an optimisation tool, having at least one LiveQuery is **necessary**.
{% endhint %}

### **3. Add** a Connect dialog UI

In the top menu: *coherence > Explore Samples*

From the Explore Samples menu, choose **Connect Dialog:** **Rooms**. The Prefab will be instantiated in your scene.

<figure><img src="https://content.gitbook.com/content/QLuEkuU7DLr3jX7gVtzJ/blobs/gj0gfXnMhh5AGjUVekr3/UI.png" alt="" width="375"><figcaption></figcaption></figure>

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](https://docs.coherence.io/1.4/getting-started/samples-and-tutorials/samples-connection-uis).

***

{% hint style="success" %}
**In this section, we:**

* Added a [CoherenceBridge](https://docs.coherence.io/1.4/manual/components/coherence-bridge) to the scene to facilitate connection to the [Replication Server](https://docs.coherence.io/1.4/manual/replication-server)
* Used a [LiveQuery](https://docs.coherence.io/1.4/manual/components/coherence-live-query) to ensure we receive network updates
* Added an in-game UI to allow players to connect over the network

Next: time to [setup some Prefabs](https://docs.coherence.io/1.4/getting-started/setup-a-project/prefab-setup)!
{% endhint %}
