Initializing the Client
Create a client with a configuration object that specifies the auth URL and region configs. For local development, use dev auth to bypass the normal authentication flow.- Unity C#
- TypeScript
Authentication
client.AuthStatus says what the game can do: SignedOut, NeedsRefresh (a saved login needs a fresh game token), or Ready. client.Player says who is playing. client.AuthChanged fires on Unity’s main thread whenever either changes. Cardinal identifies the player by the stable player ID in the game token.
- Unity C#
- TypeScript
- Unity C#
- TypeScript
Connecting to a Shard
A shard is a single instance of your game world running on the server. The shard client is your connection to that instance, allowing you to send commands and subscribe to events. To connect, specify the shard’s region and ID and call connect to get a shard client. The organization and project come from the client config.- Unity C#
- TypeScript
- Unity C#
- TypeScript
Sending Commands
Build a command payload and send it to the shard. See Commands for more details.- Unity C#
- TypeScript
Subscribing to Events
Subscribe to events with handler callbacks. See Events for more details.- Unity C#
- TypeScript
- Unity C#
- TypeScript