# 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: *GameObject > coherence > Bridge*

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

<figure><img src="/files/EVVXFIUto7OpYGMPLKbP" alt="" width="375"><figcaption></figcaption></figure>

This object manages the connection with coherence's relay, the [Replication Server](/manual/replication-server.md), 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: GameObject *> coherence > Live Query*

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

<figure><img src="/files/KqMHBaw7PDU44CqsYtoR" alt="" width="375"><figcaption></figcaption></figure>

A [LiveQuery](/manual/components/coherence-live-query.md) 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

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

In the top menu: *coherence > Hub*

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

<figure><img src="/files/tqJvBE1ODm6EmYplffbr" alt=""><figcaption></figcaption></figure>

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.

{% hint style="info" %}
This sample uses Unity GUI (UGUI). For input events to be forwarded properly, you'll need at least an EventSystem (GameObject > UI > Event System)
{% endhint %}

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](/getting-started/samples-and-tutorials/samples-connection-uis.md).

***

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

* Added a [CoherenceBridge](/manual/components/coherence-bridge.md) to the scene to facilitate connection to the [Replication Server](/manual/replication-server.md)
* Used a [LiveQuery](/manual/components/coherence-live-query.md) 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](/getting-started/setup-a-project/prefab-setup.md)!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherence.io/getting-started/setup-a-project/scene-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
