• Stars
    star
    165
  • Rank 227,884 (Top 5 %)
  • Language
    C#
  • Created about 4 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 <script> tag
// add other firebase services as needed...
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-firestore-compat.js"></script>
  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.

More Repositories

1

Unity-Firebase-Multiplayer-Example

Multiplayer and Matchmaking system using Firebase Realtime Database in Unity
C#
47
star
2

Firebase-Auth-with-Google-REST-API

An example of a implementation with REST APIs of Firebase Authentication with Google provider (based around this tutorial: https://youtu.be/AWp9RdxTJco)
C#
18
star
3

Tensorflow2UnityTest

Sample code for importing Tensorflow in Unity using a Pyhon web socket
ShaderLab
17
star
4

Firebase-Database-Tutorial

Source code of this video: https://www.youtube.com/watch?v=Fz0Sl4tW5O0&feature=youtu.be
C#
15
star
5

Firebase-Database-REST-API

Simple Firebase Database Unity implementation example using REST API
C#
10
star
6

Firebase-Chat

An example of a chat system using Firebase Realtime Database
C#
7
star
7

Firebase-Authentication-Tutorial

Source code of this video: https://www.youtube.com/watch?v=dq8PAWLEo3E&feature=youtu.be
C#
6
star
8

CircularRevealExample

An example of Circular Reveal animation for android lollipop
Java
3
star
9

Kencryption

Encrpyt and decrypt strings using seeds
Kotlin
3
star
10

Datapack-Converter

Convert Minecraft command block chains to a datapack!
Python
3
star
11

Commands-Converter

Convert Minecraft datapack to command block chains!
Python
2
star
12

encryption-test

In order to try this out
Processing
2
star
13

blFrozen

2
star
14

NeuralNetworkExample

An example of Neural Networks using Unity C#
CSS
2
star
15

Delay

Tactic 2D board game made with Unity
C#
2
star
16

Locked

Sokoban style puzzle game
C#
2
star
17

Sokoban-Editor

Create your own sokoban puzzles with this web editor!
CSS
2
star
18

Firebase-Smart-Reply-Tutorial

Source code of this tutorial video: https://www.youtube.com/watch?v=eIYDsNxq12w&feature=youtu.be
Kotlin
2
star
19

Firebase-Authentication-Tutorial-Email-Verification

Source code of this tutorial video: https://www.youtube.com/watch?v=DIOM70JctRs&feature=youtu.be
C#
2
star
20

Voice-Command-Input-Example

A simple speech recognition example in Python that translates your voice in keyboard/mouse inputs
Python
1
star
21

ddracenetwork-ubuntu

Shell
1
star
22

Genetic-Calculator

An Android library that will make you calculate from parents genotypes, sons genotypes and phenotypes!
Java
1
star
23

Firebase-Authentication-REST-API

Simple Firebase Authentication Unity implementation example using REST API
C#
1
star
24

Flappy-AI-Code

Flappy + Bird + AI
C#
1
star
25

Bow-Arrow-AI-Code

Machine Learning NEAT AI for the game Bow & Arrow
C#
1
star
26

identification-card

HTML
1
star
27

AgoraWebGL

A simple implementation of the Agora service for Unity WebGL
CSS
1
star
28

UnityScreenCapture

A screen capture for Unity, using a Python local server
Python
1
star
29

Unfair-Application

It's an application and it's unfair :(
Java
1
star
30

unity-firebase-rest

Firebase Handler Library using REST APIs and FullSerializer
C#
1
star
31

Hashcode-2019-Random

An advanced machine learning algorithm to get the best score in the Hashcode 2019 competition (nah just kidding, it's just random but somehow it gets 300k points)
Java
1
star
32

hashcode-pizza-problem

This is my attempt at the test problem of Hashcode 2019! So far I am getting a score of 876515 but I will try to optimize it further!
Java
1
star