spacetimedb-unity
OfficialIntegrate SpacetimeDB into Unity games
Authorclockworklabs
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides Unity-specific patterns and lifecycle guidance to correctly connect, maintain, and use SpacetimeDB in Unity projects, preventing common issues like missed callbacks, thread-safety violations, lost connections on scene load, and token loss.
Core Features & Use Cases
- Connection lifecycle management: Use a SpacetimeManager MonoBehaviour singleton with DontDestroyOnLoad, Awake/Start/OnDestroy hooks, and proper OnConnect/OnDisconnect handling.
- Frame-driven networking: Ensure Connection.FrameTick() is invoked from Update() on the main thread so queued network messages are processed and callbacks fire.
- Subscriptions, reducers, and client cache: Generate C# module bindings, subscribe to tables, register OnInsert/OnUpdate/OnDelete handlers, call reducers from UI, and persist auth tokens with PlayerPrefs for seamless reconnects.
- Use Case: Real-time multiplayer game state synchronization and chat where deterministic main-thread processing and token persistence are required.
Quick Start
Create a SpacetimeManager MonoBehaviour that builds a DbConnection with WithUri and WithDatabaseName, persists the auth token to PlayerPrefs in OnConnected, and calls Connection.FrameTick() from Update().
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: spacetimedb-unity Download link: https://github.com/clockworklabs/SpacetimeDB/archive/main.zip#spacetimedb-unity Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.