• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Navadan · Aug 16, 2017 at 11:38 AM · webglscript loading

Use firebase with webGL build

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 https://stackoverflow.com/a/950146

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ACCACORE · Mar 04, 2021 at 12:08 PM

Yuu could use this plugin: https://assetstore.unity.com/packages/tools/network/api-for-firebase-189910

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Navadan · Aug 17, 2017 at 08:11 AM

I have solved it now. I ended up using the WWW module combined with this from firebase.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image peterworth · Sep 13, 2017 at 01:07 PM 0
Share

But it seems like you can't do authentication using the REST API? I don't see how you can realistically use a firebase database without authentication for the rules, how did you deal with that?

avatar image veereshkumbar · Oct 27, 2017 at 05:51 AM 0
Share

can u please show me the code how you did it . I want to build my game in 3 platforms iOS, Android and WebGL using Firebase but when i use firebase namespace its showing errors while building Game for WebGL platform. Please Help

avatar image Navadan · Nov 08, 2017 at 08:22 AM 0
Share

As @peterworth pointed out, it doens't seem like you can do authentication using the REST API. At least not for Web GL, since anyone can see the json-request being send and recived. So I have now marked this as unanswered again, and am still looking for answer.

avatar image Dragate Navadan · Nov 08, 2017 at 08:32 AM 0
Share

@Navadan Don't think it's possible. Lately, I did some research on using Firebase Storage with Auth (not for WebGL) and I stumbled upon a Q&A video made by a firebase dev and he happened to say that it's not possible with WebGL. However, since the video's release maybe they have made some improvements.

avatar image panpan1997 · Jun 20, 2018 at 02:17 PM 0
Share

may you send me the code of how to use WWW module for firebase? please I search and work out for this very long time and i cannot have a right solution to solve the problem

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

119 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GL_INVALID_FRAMEBUFFER WebGL using LWRP 1 Answer

What are Unity's default emscripten arguments during build? 0 Answers

Help - Export to WebGL 0 Answers

Unity WebGL hosted in .NET Core not connecting to Redis 0 Answers

Unity Project Build using WebGL..Error,WebGL Build Error 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges