LogoLogo
⚠️ Outdated documentationGo to LatestHomeAPI
SDK 0.10
SDK 0.10
  • Welcome
  • Overview
    • What is coherence?
    • How does coherence work?
    • Rooms and Worlds
    • Features and Roadmap
    • Release Notes
    • Known Issues and Troubleshooting
  • Learning coherence
    • First Steps tutorial
      • 1. Basic syncing
        • 1.2. Animation parameters
        • 1.3. Sending commands
      • 2. Physics / Authority transfer
      • 3. Areas of interest
      • 4. Parenting entities
      • 5. Complex hierarchies
      • 6. Persistence
    • How to network...
      • Racing
      • Turn-based
      • First-Person Shooter
      • MMO
      • Fighting
  • Get started
    • Installation
    • Scene Setup
      • Sample UI
    • Prefab Setup: CoherenceSync
    • Local Development
      • Tips and Recommendations
    • coherence Cloud
      • Create a Free Account
      • Deploy a Replication Server
      • Share Builds
  • coherence SDK for Unity
    • Components
      • CoherenceSync
      • CoherenceMonoBridge
      • CoherenceLiveQuery
      • CoherenceTagQuery
      • Order of execution
    • Networking State Changes
      • Messaging with Commands
      • Hierarchies & Child Objects
        • Child GameObjects
        • Child CoherenceSyncs
        • Deep Child CoherenceSyncs
      • Animations
      • CoherenceSync References
      • [Sync] and [Command] Attributes
      • [OnValueSynced] Attribute
      • Supported Types
      • Player Name (Sample UI)
    • Baking (Code Generation)
    • Authority
      • Authority transfer
      • Server-authoritative setup
    • Lifetime
      • Persistence
      • Example – a global counter
    • Optimization
      • Simulation Frequency
      • Areas of Interest
      • Level of Detail (LOD)
    • Interpolation
    • Settings
    • Simulation Frame
    • Replication Server
    • Simulators
      • Scripting: Client vs Simulator
      • Local Development
      • World Simulators
      • Room Simulators
      • Simulator Slugs
      • Multi-Room Simulators
      • Build and Publish
      • Command-line arguments
      • Load Balancing
      • Network Connectivity
    • Client Connections
    • Rollback Networking Support
    • Floating Origin
    • CLI
  • coherence API
    • Worlds
    • Rooms
    • PlayResolver
    • DescriptorProvider
  • Developer Portal
    • Overview
    • Dashboard
    • Worlds
    • Rooms
    • Game Services
      • Account
      • Key-Value Store
      • API
        • Game account
        • Key-value store
  • Schema explained
    • Overview
    • Specification
    • Field settings
    • Archetypes
  • Additional resources
    • Community
    • SDK Upgrade Guide
    • Video Tutorials
    • Quick Samples
    • Continuous Integration
    • Unreal Engine Support
    • WebGL Support
    • Peer-to-Peer Support (P2P)
    • Pricing
    • SLA
    • Glossary
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. coherence API

Worlds

Worlds API

Worlds functionality can also be accessed through the PlayResolver just like rooms. Worlds work a differently however and are a bit simpler.

Worlds

First we need to fetch the available Worlds. Unlike Rooms, Worlds cannot be created by a Client and need to be setup in the Developer Portal.

async Task<(IReadOnlyList<WorldData>, bool)> FetchWorlds()

FetchWorlds in PlayResolver.cs allows us to fetch the available Worlds for our project. This task returns a list of Worlds in the form of WorldsData objects and a boolean that indicates if the operation was successful.

This method also calls EnsurePlayConnection which initializes the needed mechanisms in thePlayResolver if necessary. EnsurePlayConnection can also be called directly for initialization.

async Task<WorldData> FetchLocalWorld()

FetchLocalWorld in PlayResolver.cs returns the local World for a local running World Server.

The WorldsConnectDialog populates a dropdown with the Worlds returned by both of these methods so we can select a World.

After we've selected a World we can connect to it using:

void JoinWorld(IClient client, WorldData data, bool isSimulator = false)

JoinWorld in PlayResolver.cs connects the Client that we pass to the method to the World we pass to the method.

The isSimulator optional parameter is used for Simulators and can be ignored for regular Client connections (see Simulators).

The WorldsConnectDialog is an example implementation for Worlds usage.

When connected to a Room or a World, the Client can access the currently connected endpoint by accessing the Coherence.IClient.LastEndpointData property of the CoherenceMonoBridge, e.g. myBridge.Client.LastEndpointData.

Last updated 2 years ago

Was this helpful?