All Projects → edricwilliem → unity-firebase-realtime-database

edricwilliem / unity-firebase-realtime-database

Licence: MIT License
Unity Firebase Realtime Database REST

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to unity-firebase-realtime-database

UnityDebug
A wrapper script for Unity debug calls to use conditional attributes in order to avoid debug code being compiled into release builds.
Stars: ✭ 29 (+20.83%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
TsukiSuite
A toolsuite created to make Unity development easier
Stars: ✭ 23 (-4.17%)
Mutual labels:  unity-asset, unity-3d, unity3d-plugin, unity-plugin
Savegamepro
A Complete and Powerful Save Game Solution for Unity (Game Engine)
Stars: ✭ 30 (+25%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
UnityGlobalTextSystem
Allow the user to 'change' the default font in Unity from "Arial" to a font of their liking.
Stars: ✭ 21 (-12.5%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
JsonFormatter
Easy, Fast and Lightweight Json Formatter. (Serializer and Deserializer)
Stars: ✭ 26 (+8.33%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
Apple Signin Unity
Unity plugin to support Sign In With Apple Id
Stars: ✭ 228 (+850%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
UnityHexagonLibrary2d
A library to manage 2D hexagonal tiles in Unity.
Stars: ✭ 58 (+141.67%)
Mutual labels:  unity-scripts, unity-asset, unity-3d, unity3d-plugin
CategoryTool
Unity Editor tool to create Categories in the Hierarchy. The Categories work as dividers between GameObjects.
Stars: ✭ 47 (+95.83%)
Mutual labels:  unity-scripts, unity3d-plugin, unity-plugin
Savegamefree
Save Game Free is a free and simple but powerful solution for saving and loading game data in unity.
Stars: ✭ 279 (+1062.5%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+15066.67%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin
Opencvforunity
OpenCV for Unity (Untiy Asset Plugin)
Stars: ✭ 359 (+1395.83%)
Mutual labels:  unity-asset, unity-3d, unity3d-plugin
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+2712.5%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin
Unity Assetpipeline Presentation
Unity project for "A Technical Deep-Dive into Unity's Asset Pipeline" presented at Develop: 2018
Stars: ✭ 31 (+29.17%)
Mutual labels:  unity-scripts, unity-asset, unity-3d
Dlibfacelandmarkdetector
FaceLandmark Detector using Dlib (Unity Asset Plugin)
Stars: ✭ 80 (+233.33%)
Mutual labels:  unity-asset, unity-3d, unity3d-plugin
Energysuite
Simple real-time energy based system for your Unity3d game
Stars: ✭ 31 (+29.17%)
Mutual labels:  unity-asset, unity-3d, unity3d-plugin
Csharp Eval Unity3d
C# Expression Parser for Unity3D
Stars: ✭ 102 (+325%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin
Unitylibrary
📚 Library of all kind of scripts, snippets & shaders for Unity
Stars: ✭ 1,968 (+8100%)
Mutual labels:  unity-scripts, unity-3d, unity3d-plugin
Realtime Csg For Unity
Realtime-CSG, CSG level editor for Unity
Stars: ✭ 281 (+1070.83%)
Mutual labels:  unity-asset, unity-3d, unity3d-plugin
Awesome Unity Open Source On Github
A categorized collection of awesome Unity open source on GitHub (800+)
Stars: ✭ 1,124 (+4583.33%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin
Unity-2017.2-and-Vuforia-6.5---Camera-Auto-Focus
Unity 2017.2 and Vuforia 6.5 Augmented Reality (AR) Camera Auto Focus
Stars: ✭ 17 (-29.17%)
Mutual labels:  unity-scripts, unity-asset, unity3d-plugin

Unity Firebase Realtime Database REST API

Write, Read, Remove and Streaming data using Firebase's database REST API

This is not firebase's official plugins library.

Tested on Android and WebGL platform. should work well on other platforms too since most of the implementation is only a simple http REST request.

Contributions to this project are welcome!.

Sample Usage

Setting Firebase

Before using the library you need to setup some settings in FirebaseSettings.cs

DATABASE_URL = "https://example.firebaseio.com/";
WEB_API = "[WEB_API_KEY]";

Write Data

Set Value:

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/save");
reference.SetValueAsync("mydata", 10,(res) => 
{
    if (res.success)
    {
        Debug.Log("Write success");
    }
    else
    {
        Debug.Log("Write failed : " + res.message);
    }
});

reference.SetRawJsonValueAsync("{\"key\":\"value\"}", 10,(res) => 
{
    if (res.success)
    {
        Debug.Log("Write success");
    }
    else
    {
        Debug.Log("Write failed : " + res.message);
    }
});

Update Child Value:

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/save");
reference.UpdateValueAsync(new Dictionary<string, object>(){
    {"child1","value1"},{"child2","value2"}
}, 10, (res) =>
{
    if (res.success)
    {
        Debug.Log("Write success");
    }
    else
    {
        Debug.Log("Write failed : " + res.message);
    }
});

Push Value:

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/save");
reference.Push("mydata, 10, (res)=>{
    if(res.success){
        Debug.Log("Pushed with id: " + res.data);
    }
    else{
        Debug.Log("Push failed : " + res.message);
    }
});

Read Data

Get Value:

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/query");
reference.GetValueAsync(10, (res) =>
{
    if (res.success)
    {
        Debug.Log("Success fetched data : " + res.data.GetRawJsonValue());
    }
    else
    {
        Debug.Log("Fetch data failed : " + res.message);
    }
});

Query & Order :

  • OrderByChild
  • OrderByKey
  • OrderByValue
  • StartAt
  • EndAt
  • LimitAtFirst
  • LimitAtLast
DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/query");
reference.OrderByChild("age").StartAt(12).EndAt(20).LimitAtFirst(5).GetValueAsync(10,(res)=>{
        if (res.success)
        {
            Debug.Log("Success fetched data : " +res.data.GetRawJsonValue());
        }
        else
        {
            Debug.Log("Fetch data failed : " + res.message);
        }
});

Delete Data

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/delete");
reference.RemoveValueAsync(10, (e) =>
{
    if (e.success)
    {
        Debug.Log("Delete data success");
    }
    else{
        Debug.Log("Delete data failed : " + res.message);
    }
});

Streaming Data

DatabaseReference reference = FirebaseDatabase.Instance.GetReference("path/to/stream");
reference.ValueChanged += (sender, e) =>
{
    Debug.Log(e.Snapshot.GetRawJsonValue());
};
reference.DatabaseError += (sender,e)=>{
    Debug.Log(e.DatabaseError.Message);
    Debug.Log("Streaming connection closed");
};

Authentication

Set the credential using saved tokens

FirebaseAuth.Instance.TokenData = new TokenData()
{
    refreshToken = savedRefreshToken,
    idToken = savedAccessToken
};

or Sign In

FirebaseAuth.Instance.SignInWithEmail("[email protected]", "example", 10, (res) =>
{
    if (res.success)
    {
        Debug.Log("Access token : " + res.data.idToken);
    }
    else
    {
        Debug.Log("Signed Failed");
    }
});

after signed in, the FirebaseAuth.Instance.TokenData will be automatically set

FirebaseAuth.Instance.TokenData will be used for authentication on every database's request.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].