Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hello

I've got a quick question/idea about Supabase libraries and how they work with single-threaded mode.

When it comes to Unity, one of the options we have for publishing is WebGL. But WebGL has a downside – it doesn't work with multi-threading (C#). So, I'm wondering if there are any plans to make Supabase-csharp work in single-threaded mode.

If this feature is already available and I just missed it, my bad!

Would appreciate any insights or updates you have on this.

You must be logged in to vote

One option would be downloading the source and adding that to your project instead of using the binaries. You could then try configuring the dependencies as needed.

Honestly, my sense is that Unity hasn't/isn't investing in WebGL all that much. Back in the day there used to be a Unity browser plugin for targeting the web, and I think the WebGL stuff was produced as an alternative to that. I get the sense that the market has more or less moved away from that sort of thing.

FWIW I think Godot's web export is in similar "well, it kind of works" state, but they were still fixing pretty basic stuff last I looked at it.

If I were targeting a browser first solution, I'd look at one of the web na…

Replies: 1 comment · 5 replies

Comment options

My two cents is that you should be able to use UniTask w/Supabase in Unity on WebGL exports. I personally haven't gone down that route, but there are some reports of folks getting UniTask to play with the standard JS event loop stuff. I did find this https://github.com/VolodymyrBS/WebGLThreadingPatcher.

Give it a spin and let us know what you find... :)

You must be logged in to vote
5 replies
@AlexHoca
Comment options

You mean accessing requests in Supabase like await supabase.From().Get()? I use UniTask for this - it's not a problem) However, supabase/csharp requires the Websocket.Client library, which in turn requires the System.Threading library, which simply doesn't load in webGL. But I will test this option, you always need to be prepared for surprises:)

@AlexHoca
Comment options

It seems that if there's ever an option to use Supabase in WebGL, it won't be anytime soon. Perhaps when Unity adds support for WebGL in some way. Alternatively, all Supabase/csharp modules might have duplicates with a single-threaded mode (Websocket, gotrue etc.), though I doubt it's a high priority at the moment :)

I tried building your Unity template for WebGL without making any changes, just replacing System.Threading.Task with Cysharp.Threading.Tasks (after that with you suggestion). However, other modules still use System.Threading, so it didn't yield much result.

@acupofjose
Comment options

@AlexHoca would you be trying to use Realtime itself? Or are you just trying to use Supabase in general and can't because of the System.Threading module?

@wiverson
Comment options

One option would be downloading the source and adding that to your project instead of using the binaries. You could then try configuring the dependencies as needed.

Honestly, my sense is that Unity hasn't/isn't investing in WebGL all that much. Back in the day there used to be a Unity browser plugin for targeting the web, and I think the WebGL stuff was produced as an alternative to that. I get the sense that the market has more or less moved away from that sort of thing.

FWIW I think Godot's web export is in similar "well, it kind of works" state, but they were still fixing pretty basic stuff last I looked at it.

If I were targeting a browser first solution, I'd look at one of the web native solutions (there are MANY) and the standard Supabase JS client instead. You can also wrap those in stuff like Tauri and/or Capacitor to get desktop and/or mobile solutions. It's not going to have the same perf/fidelity options but it's all about figuring out your first/primary target and going from there.

Answer selected by AlexHoca
@AlexHoca
Comment options

@acupofjose Using Supabase in the webGL variant was a simple solution for my task, but since it's not possible, I'll implement it differently, but still use Supabase for the Android project. There are no issues here; I've tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.