Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

304
Vistas
Unable to configure saving and loading with firebase

I followed all steps such as adding the database SDK to Unity etc., but when I try to connect Unity to Firebase, I'm getting an error.

Assets\Script\RealTimeLoading.cs(14,21): error CS0029: Cannot implicitly convert type 'Firebase.Database.DatabaseReference' to 'DatabaseReference'

I followed a lot of tutorials, they are never getting errors, just me. Here is my code

 using Firebase;
 using Firebase.Database;
 using Firebase.Unity.Editor;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class RealTimeLoading : MonoBehaviour
 {
     DatabaseReference reference;
     // Start is called before the first frame update
     void Start()
     {
         reference = FirebaseDatabase.DefaultInstance.RootReference;
        
 
 
     }
     // Update is called once per frame
     void Update()
     {
         
     }
 }

The error is on this line:

 FirebaseDatabase.DefaultInstance.RootReference;

What did I do wrong?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

After briefly going through your using statements, I don't believe that there should be a DatabaseReference other than the one in Firebase.Database. That makes me think that you have another class in your project's root namespace with the same name.

First, I'd recommend removing Firebase.Unity.Editor and definitely let me know if there's still some documentation recommending it.

Then you should be able to simply write:

using DatabaseReference = Firebase.Database.DatabaseReference;

with your other using directives. So the top of your file may look like:

using Firebase;
using Firebase.Database;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using DatabaseReference = Firebase.Database.DatabaseReference;

Be careful with this because if there is another class named DatabaseReference in your code base, you may run into this naming conflict more often. It could be beneficial to either move it to its own namespace or to rename it if possible. But this should get you unstuck immediately.

Alternatively: instead of adding the using alias, you may instead fully qualify the name in your class. For example:

using Firebase;
using Firebase.Database;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class RealTimeLoading : MonoBehaviour
{
    Firebase.Database.DatabaseReference reference;
    // Start is called before the first frame update
    void Start()
    {
        reference = FirebaseDatabase.DefaultInstance.RootReference;
    }
}

I would recommend against doing both of these in one file, but you may have to use each under different circumstances.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda