# 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.

![](https://4229720839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdBiAEtFeZKdAwRyJ9MEL%2Fuploads%2Fcagf1BFyCKY6enDYWmYX%2Fimage.png?alt=media\&token=1540b413-ff60-4af2-82c6-39ee9dabc32a)

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

{% hint style="info" %}
See chapter [Simulators](https://docs.coherence.io/0.10/coherence-sdk-for-unity/simulation-server) 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.

![](https://4229720839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdBiAEtFeZKdAwRyJ9MEL%2Fuploads%2FoZNVLgqgVzCSMJJB2E0d%2FSampleUI_SelectRoom.png?alt=media)

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.

![](https://4229720839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdBiAEtFeZKdAwRyJ9MEL%2Fuploads%2FR9wH8bBweZT96WAqiRXn%2FSampleUI_CreateRoom.png?alt=media)

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.

![](https://4229720839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdBiAEtFeZKdAwRyJ9MEL%2Fuploads%2FK7cnkgsflnG7JjDmstlr%2FSampleUI_JoinWorld.png?alt=media)

{% 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](https://docs.coherence.io/0.10/coherence-api/playresolver), [Rooms](https://docs.coherence.io/0.10/coherence-api/rooms) or [Worlds](https://docs.coherence.io/0.10/coherence-api/worlds) according to what your project needs.
{% endhint %}
