Firebase in Unity WebGL build

1,350 views
Skip to first unread message

Peter Worth

unread,
Sep 14, 2017, 10:25:14 AM9/14/17
to Firebase Google Group
Is there any way at all to use a realtime database in a Unity WebGL project?

If i understand right, the database unity SDK will work, but not the auth SDK, is that right? (Why is that, and is it likely to change in the near future?) The alternatives i can see are:

1) use the REST API to do auth (i've got this working in unity just using the WWW class), but then i can't see a way of using the auth token received from the REST API to authenticate with the database SDK.

2) write a WebGL plugin that uses the javascript SDK. Will this work? It could be quite a lot of extra work, and if you were also doing iOS/android builds, you'd have to check what platform you're on etc.

Stewart Miles

unread,
Sep 19, 2017, 6:46:05 PM9/19/17
to Firebase Google Group
You're correct that we don't support WebGL export.  Most of the API is built on top of our C++ SDK which in theory could be converted to Javascript using Emscripten or WebAssembly but we haven't got around to that yet.

Regarding what you could do yourself at the moment:

On Thu, Sep 14, 2017 at 3:17 AM, Peter Worth <peter...@gmail.com> wrote:
Is there any way at all to use a realtime database in a Unity WebGL project?

If i understand right, the database unity SDK will work, but not the auth SDK, is that right? (Why is that, and is it likely to change in the near future?) The alternatives i can see are:

1) use the REST API to do auth (i've got this working in unity just using the WWW class), but then i can't see a way of using the auth token received from the REST API to authenticate with the database SDK.

We don't publish a public API for authentication, so we could change the behavior that doesn't affect our SDKs but could affect your port.
 

2) write a WebGL plugin that uses the javascript SDK. Will this work? It could be quite a lot of extra work, and if you were also doing iOS/android builds, you'd have to check what platform you're on etc.

TBH I think this is the most stable path forward.  You'll end up with cutting edge, up to date functionality and won't need to worry about us breaking your SDK.  In order to support this you could use a conditionally compiled implementation for WebGL, we already do this for iOS vs. non-iOS builds if you look at our platform settings on the Firebase DLLs in the SDK.  
 

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2750de8b-dce5-4f1d-b3c7-61f01890ce1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages