Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

302
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!