Skip to content

Instantly share code, notes, and snippets.

View wiverson's full-sized avatar

Will Iverson wiverson

View GitHub Profile
@wiverson
wiverson / SupabaseManager.cs
Created August 28, 2023 23:17
SupabaseManager.cs - example of bootstrapping Supabase in Unity
using System;
using io.notification;
using Supabase;
using Supabase.Gotrue;
using Supabase.Gotrue.Interfaces;
using TMPro;
using UnityEngine;
using static io.notification.NotificationManager;
using static io.notification.NotificationManager.NotificationType;
using Client = Supabase.Client;
using System;
using System.IO;
using io.notification;
using Newtonsoft.Json;
using Supabase.Gotrue;
using Supabase.Gotrue.Interfaces;
using UnityEngine;
using static io.notification.NotificationManager.NotificationType;
namespace io.supabase

Some of my favorite tools for dev on macOS in 2023.

  • Powerlevel10k. Adds much nicer prompts/themes. Particularly like being able to see what Git repo & branch I am currently in.
  • Fig Adds much nicer auto-complete to the Terminal.
  • 1Password Adds SSH key management at the CLI.
  • GitHub Desktop Because 99% of the time this is better. Diffs, commits, branches, PRs...
  • SDKMan Install and manage JDKs and Maven installs.
  • JetBrains Absolutely invaluable for Java (Intelli/J) and C# (Rider).
  • DBSchema One of the best tools for roundtrip visual design for RDBMS.

To center something with a maximum width:

  1. Parent GameObject
    1. Add Horizontal or Vertical Layout Group
    2. Enable 'Control Child Size' and Disable 'Child Force Expand'
  2. Child GameObject
    1. Add 'Layout Element'
  3. Set Preferred Height and/or Width
@wiverson
wiverson / build.sh
Created May 11, 2023 18:38
Build script to download both the latest supabase-csharp libs as well as the current source.
#!/bin/bash
rm -rf target
rm -rf nuget
rm -rf unpack
mkdir nuget
mkdir target
mkdir unpack
./bin/nusave-3.1.1-dawrin-x64/nusave cache package "supabase-csharp@0.9.1" --targetFrameworks ".NETStandard@2.0" --cacheDir "nuget"
./bin/nusave-3.1.1-dawrin-x64/nusave cache package "Websocket.Client@4.6.1" --targetFrameworks ".NETStandard@2.0" --cacheDir "nuget"
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@wiverson
wiverson / AppleSignIn.cs
Created April 28, 2023 23:20
Demo of using Apple Sign in with Supabase and Unity
using System;
using System.Text;
using AppleAuth;
using AppleAuth.Enums;
using AppleAuth.Extensions;
using AppleAuth.Interfaces;
using AppleAuth.Native;
using TMPro;
using UnityEngine;
@wiverson
wiverson / SupabaseStuff.cs
Created April 28, 2023 23:19
Demo illustrating connecting Supabase to Unity
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using Postgrest.Responses;
using Supabase.Gotrue;
using Supabase.Gotrue.Exceptions;
using TMPro;
using UnityEngine;
using Client = Supabase.Client;

Unity with Supabase

Here are my notes on getting Supabase working with Unity.

If you are only interested in using Supabase with your project with email/password accounts, it's pretty easy. The main thing is to use the Unity NuGet package to install UniTask (async/await) and supabase-csharp.

However, the really neat part is also supporting native Sign in With Apple on iOS. Apple is increasingly requiring developers to support Sign in with Apple on iOS, and it does provide a pretty seamless experience. One nice thing is that by following these steps Supabase integrates both the on-device native Sign in with Apple and the web-based version of Sign in with Apple. This means you could do something like having a iOS Unity project for your main gameplay or application, and also allow users to use the same account to access details in a web application (e.g. something you build in SvelteKit or React or whatever).

I'm assuming you want to support Sign in with Apple, so I'm providing the steps in the order I wou

Steps to get Capacitor working with SvelteKit

  1. Set up a SvelteKit project as usual.
npm create svelte@latest my-app
cd my-app
npm install
npm run dev -- --open