How would I go about using firebase as a database with my WebGL build? What I know so far is that I probably have to interact with browser scripting, since there’s no firebase SDK for WebGL. To communicate with Firebase I have to import a script as per the firebase for web guide, but I don’t know how to import this script.
What I’ve tried:
- Copy paste the script into a .jslib file and putting the file in the plugins for WebGL folder, both with and without the “mergeInto(LibraryManager.library, {//firebase.js here}”
- Using Dynamic Script Loading from this answer How do I include a JavaScript file in another JavaScript file? - Stack Overflow
Both of these methods seem to cause the build to fail with these errors:
Failed running “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe” “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc” @“C:\Users\Emil\CloudStation\Koder\Unity\Flick\Assets..\Temp\emcc_arguments.resp”
Exception: Failed building WebGL Player.
UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
So I think that what I need to know is how to correctly import the firebase.js script.