百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

FirebaseWebGL

> 编程语言
开源

一个 Unity 包,它利用 Firebase JavaScript SDK 来在 WebGL 构建中实现基本的实时数据库功能。

196 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个 Unity 包,它利用 Firebase JavaScript SDK 来在 WebGL 构建中实现基本的实时数据库功能。

FirebaseWebGL

A Unity package that makes use of the Firebase Javascript SDK to implement the basic Realtime Database functions on WebGL builds

Installation

  • Copy the FirebaseWebGL folder into your Unity project assets folder.
  • Consider also adding the RestClient, Fullserializer and Textmeshpro folders to get the project fully up and running.
  • Alternatively, you can import the latest .unitypackage from the repository releases.

Usage

  1. Call any of the basics Firebase Javascript SDK functions from the FirebaseBridge.cs class
  2. Build for WebGL
  3. Include the Firebase app configuration in the index.html file generated by Unity (you can use this tutorial here).
const firebaseApp = firebase.initializeApp({
    apiKey: "XXXXXXXXXXXXXXX",
    authDomain: "XXXXXXXXXX.firebaseapp.com",
    databaseURL: "https://XXXXXXXXXXXXXXX.firebaseio.com",
    projectId: "XXXXXXXXXXXXXX",
    storageBucket: "XXXXXXXXXXXXX.appspot.com",
    messagingSenderId: "XXXXXXXXXXXXX",
    appId: "X:XXXXXXXXXXXXXXX:web:XXXXXXXXXXXXXXXX",
    measurementId: "XXXXXXXXXXXXX"
});
const db = firebaseApp.firestore();
const auth = firebaseApp.auth();
// declare other services here...
  1. Finally, make sure to also include the Firebase SDKs you need to use in your App (You can find a list of services here). The “modular” version from the SDK version 9 is not working. Use this “compat” version that works as a compatibility mode.
// add this lines before the final 
  1. EXTRA STEP: Earlier in 2021 Unity made some modifications to their WebGL library. The following line (window.unityInstance = unityInstance) must now also be added in your index.html, when the unityInstance is created (after the }).then((unityInstance) => { line) so that your app can properly comunicate with Unity.
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
	progressBarFull.style.width = 100 * progress + "%";
 }).then((unityInstance) => {
	// add this line :
	window.unityInstance = unityInstance;
	loadingBar.style.display = "none";
	// ...

Services

  • Realtime Database
  • Authentication
  • Cloud Functions
  • Storage
  • Firestore

Additional info

  • You can find a working implementaiton of this package here
  • For Storage, you'll also need to set up cors for your bucket. More info here or in the README.txt file in the Storage example in the project.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言