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.
The Auto Simulator Connection component is used by Simulator builds to connect to the relevant Replication Server.
See chapter Simulators to learn more about them.
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.
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.
Beneath these elements is a Rooms list of available Rooms in the selected region.
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.
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.
You can also build your own interface to connect players to the Server using thePlayResolverAPI. To learn more about the API, see either PlayResolver, Rooms or Worlds according to what your project needs.