Supabase with Unity & C#
Setting Up Supabase
Supabase provides a powerful backend solution for Unity game developers, combining PostgreSQL, authentication, and storage in one platform. This guide walks through the initial setup — future articles will explore each feature in depth.
Creating a Supabase Project
Step 1: Sign Up
- Go to Supabase [https://supabase.com/] and sign up (GitHub, Google, or email).
- Select “New Project” from the dashboard.
Step 2: Configure Project
- Name: Choose a project name (e.g., MyUnityGame_Dev).
- Database Password: Set a secure password (store it safely).
- Region: Pick a region closest to your players for lower latency.
- Pricing Plan: Start with the Free tier for development.
Step 3: Wait for Deployment
- Supabase spins up your PostgreSQL database and services (~2 minutes).
Once ready, note the Project URL and API Keys (under Settings > API).
Basic Service Configuration
Database (Preview: Article 9)
- Navigate to Table Editor and create your first table (e.g., players).
- Enable Row-Level Security (RLS) for data protection:
CREATE POLICY "Enable read access for authenticated users"
ON players FOR SELECT USING (auth.role() = 'authenticated');Authentication (Preview: Article 4)
- Go to Authentication > Providers and enable:
— Email/password
— Social logins (Google, Apple, etc.).
- Test sign-up with the built-in Auth UI.
Storage (Preview: Article 7)
- Navigate to Storage > Buckets and create a bucket (e.g., game_assets).
- Set RLS policies to control file access:
CREATE POLICY "Allow uploads for authenticated users"Get Lem Apperson’s stories in your inbox
Join Medium for free to get updates from this writer.
ON storage.objects FOR INSERT TO authenticated WITH CHECK (true);
Essential Dashboard Settings
API Keys & Security
- Project URL: Found under Settings > API (e.g., https://xyz.supabase.co).
- Keys: Use the anon (client-side) and service_role (server-side) keys cautiously.
(Look above to Step 3)
Realtime & SQL Editor
- Realtime: Enable for live multiplayer features (toggle in Database > Replication).
- SQL Editor: Save frequent queries for quick access.
(See above under Database/ Row Level Security)
Local Development (Optional)
- Install the Supabase CLI for local testing:
brew install supabase/tap/supabase # macOS supabase init && supabase startFurther Reading
Official Documentation & SDKs
- Supabase Docs [https://supabase.com/docs]
Comprehensive guides on PostgreSQL, Auth, Storage, and Realtime features. - supabase-csharp GitHub [https://github.com/supabase-community/supabase-csharp]
Official C# SDK for Supabase, including Unity compatibility notes.
Unity-Specific Integration
- Supabase Unity Template [https://github.com/wiverson/supabase-unity-template]
Starter project demonstrating authentication, RPC calls, and real-time updates in Unity. - kamyker/supabase-unity [https://github.com/kamyker/supabase-unity]
Prepackaged Unity module with dependency resolution (alpha stage). - Unity Asset Store: Supabase Integration [https://assetstore.unity.com/packages/tools/integration/supabase-integration-311866]
Paid plugin ($49.99) with tested compatibility for Unity 2022.3+.
Tutorials & Videos
- Supabase with Unity (YouTube) [https://www.youtube.com/watch?v=S0hTwtsUWcM]
Step-by-step guide covering email/auth and Apple Sign-In integration. - Supabase C# Update (YouTube) [https://www.youtube.com/watch?v=iLdsPuuULh8]
Latest library features and Unity template walkthrough.
Community & Troubleshooting
- Supabase Discord [https://discord.supabase.com/]
Active community for troubleshooting and best practices. - Unity Multiplayer Resources [https://unity.com/resources]
Unity’s official guides on networking and live services (complementary to Supabase).
Key Tools
- NuGetForUnity [https://github.com/GlitchEnzo/NuGetForUnity]
Essential for managing Supabase dependencies in Unity projects. - UniTask [https://github.com/Cysharp/UniTask]
Required for async/await support in Unity with supabase-csharp.









