LogoLogo
⚠️ Outdated documentationGo to LatestHomeAPI
SDK 0.8
SDK 0.8
  • Welcome
  • Overview
    • What is coherence?
    • How does coherence work?
    • Features and Roadmap
    • Rooms and Worlds
    • Requirements
  • Get Started
    • Install coherence
    • Scene setup
    • Prefab setup
    • Baking and code generation
    • Build and run
    • Create a free account
    • Deploy replication server
    • Share builds
  • Authority and communication
    • How authority works
    • Authority transfer
    • Commands
    • Client connections
    • Input Queues
    • Input prediction and rollback
    • Animations
    • Value sync callbacks
  • Persistence
    • Overview
    • Configuring persistence
    • Storage
    • Example – A global counter
  • Optimization
    • Overview
    • Simulation frequency
    • Areas of interest
    • World size
    • Level of detail
    • Interpolation
    • Extrapolation
  • Connected entities
    • Overview
    • Entity references
    • Parent-child relationships
    • CoherenceNode
  • Simulators
    • Overview
    • Client vs. simulator logic
    • Build and deploy
    • Simulator load balancing
    • Room Simulators
    • Multi-Room Simulators (Advanced)
    • World Simulators
    • Simulator Slugs
    • Testing Simulators Locally
  • Tutorial project
    • Get the Tutorial Project
    • Start Tutorial
      • 1. Transforms
      • 2. Physics
      • 3. Persistence
      • 4. Animation and Variables
      • 5. AI Navigation
      • 6. Network Commands
      • 7. Team based
      • 8. Connected Entities
  • Game Services
    • Game account
    • Key-value store
    • Matchmaking
  • Developer Portal
    • Overview
    • Dashboard
    • Enabling Game Services
    • Configure Rooms
    • Manage Worlds
  • API reference
    • Network SDK
      • CoherenceSync
      • MonoBridge
      • LiveQuery
      • Archetype
      • Sample UI
      • Settings Window
      • Custom Bindings (Advanced)
      • PlayResolver
      • Rooms
      • Worlds
    • Cloud API
      • API tokens and keys
      • Game account
      • Key-value store
      • Matchmaking
    • Replication Server
    • Simulation Server
  • Schema reference
    • Overview
    • Specification
    • Field Settings
    • Archetypes and LOD-ing
  • Resources
    • Downloads
    • SDK Update Guide
    • Video Tutorials
    • Glossary
    • CLI Utilities
    • Simulator CLI arguments
    • Helper Scripts
    • Troubleshooting
  • Community
    • Discord
  • Additional information
    • Pricing
    • SLA
    • Unreal Engine support
    • WebGL
    • Peer-to-Peer (P2P)
    • Known Issues
    • Changelog
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. API reference
  2. Network SDK

Sample UI

Last updated 3 years ago

Was this helpful?

The coherence Sample UI is a prefab that you can add to your scene that handles interaction with coherence services. It 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 Reconnect components are used by Simulator builds. The relevant Auto Reconnect component is also enabled when switching between Rooms and Worlds.

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

At the top of the dialog is a dropdown for region selection. This dropdown is populated when regions are fetched and automatically selects the first one available.

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 menu item).

This effects the local region for Rooms and the local worlds for Worlds.

Next the dialog holds an input field for the players name.

Beneath these elements is a tab group with two sections.

The first section holds a list of rooms fetched from the currently selected region. The user can select one of these rooms and connect to it using the join button. On the left of this tab is a button to refresh the rooms list, fetching them again. This refresh is also triggered whenever the selected region is changed.

The second section is used for room creation. Two input fields allow us to specify a room name and a maximal number of players.

The buttons at the bottom of this section then allow the creation of a room with the specified parameters. The Create and Join button allows the user to automatically connect to the room that was created by the request right away.

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

The dropdown is populated when worlds are fetched and automatically selects the first one available.

The connect button tells the client to connect to the selected world.

To learn more about simulators see

Note: You can also build your own interface to connect players to the server using thePlayResolverAPI to learn more about the API see , or according to what your project needs.

Simulators
PlayResolver
Rooms
Worlds