# Sample UI

The `coherence Sample UI` is a Prefab that you can add to your scene. It handles interaction with **coherence** services, is made up of a Unity UI Canvas and includes everything needed to handle connection to **coherence**.

The `UI` component on the root of the Prefab allows us to switch between using Rooms or Worlds. Each of these methods has a dedicated dialog for connection.

![](/files/MCthtKrTJ9fbddYJF74j)

The `Auto Simulator Connection` component is used by Simulator builds to connect to the relevant Replication Server.

{% hint style="info" %}
See chapter [Simulators](https://github.com/coherence/docs/blob/sdk-0.8/api-reference/network-sdk/broken-reference/README.md) to learn more about them.
{% endhint %}

The *Rooms Connect Dialog* has a few components that facilitate the usage of Rooms.

At the top of the dialog we have an input field for the player's name.

Next is a dropdown for region selection. This dropdown is populated when regions are fetched. The default selection is the first available region.

{% hint style="info" %}
Due to current limitations the local Server is fetched only if it's started before you enter Play Mode. The *Local Development Mode* checkbox must also be checked in the project settings (*coherence > Settings*).

This affects the local region for Rooms and the local worlds for Worlds.
{% endhint %}

Beneath these elements is a Rooms list of available Rooms in the selected region.

![](/files/nymDLnuVUiKrWZG1CfKg)

After selecting a Room from the list the *Join* button can be used to join that Room.

The *New Room* tab will take us to the Room creation screen.

![](/files/DLjYUjDtOKiIKkRFSH5D)

This screen contains controls for setting a Room's name and maximum player capacity. Pressing the *Create* button will create a Room with the specified parameters and immediately add it to the *Room List* in the previous tab. *Create and Join* will create the room, and join immediately

The *Worlds Connect Dialog* is much simpler. It simply holds a dropdown for region selection, an input field for the players name, and a *Connect* button.

![](/files/sSEazGEF1ilS88hrDLcf)

{% hint style="info" %}
You can also build your own interface to connect players to the Server using the`PlayResolver`API. To learn more about the API, see either [PlayResolver](/0.9/api-reference/network-sdk/playresolver.md), [Rooms](/0.9/api-reference/network-sdk/rooms.md) or [Worlds](/0.9/api-reference/network-sdk/worlds.md) according to what your project needs.
{% 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/0.9/api-reference/network-sdk/sample-ui.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.
