Firebase Real Time Database only works within the unity editor

0

I'm doing a project in unity where I use firebase and doing the tests in the unity editor I get data but once I try it on my phone it does not work. There are no errors or crashes, it just does not show data. I leave an example:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Firebase;
using Firebase.Database;
using Firebase.Unity.Editor;

public class LoadData : MonoBehaviour{
    Text a;
    string x;
    // Use this for initialization
    void Start() {
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("el link de la base de datos");
        Firebase.Database.FirebaseDatabase dbInstance = Firebase.Database.FirebaseDatabase.DefaultInstance;
        dbInstance.GetReference("Niveles/1/1/Nombre").GetValueAsync().ContinueWith(task => {
            if (task.IsFaulted) {
                // Handle the error...
            } else if (task.IsCompleted) {
                a = GetComponent<Text>();
                DataSnapshot snapshot = task.Result;
                x = snapshot.Value.ToString();
                a.text = x;
            }
        });
    }

    // Update is called once per frame
    void Update(){

    }
}
    
asked by SBerkoW 03.10.2018 в 23:44
source

0 answers