Reputation: 21
So I was creating an application for my final course project and I decided to use Unity. I am pretty new to both Unity and Firebase but I managed to make it all work in the end.
So far so good, but when I built it and tested it I realised Firebase was not working. I searched up in this forum and all I could find were solutions to Android, or IOS issues but as far as I know, Firebase should also work for desktop games. So in the game data folders I could find the google-services-desktop.json
, set up for my firebase with all the data the google-services.json
had.
Some posts I found said that I should make sure SDK is updated in the Package Manager, but it does not even show up (probably because the project is PC, Mac & Linux Standalone platform, I guess); and the rest of the possible solutions I found were related to the Android plugins folder and the "res/values/google-services.xml" file, which I obviously do not have in my Project as it is not an Android game.
I thought it should work with that google-services-desktop.json
file, but maybe I need other files or something?? I already tried some stuff and I can't really think of any solution to it.
My game only uses the Database (Realtime Database), it has no Auth nor other packages. I use it for an scoreboard mainly, and it works in the Unity Editor but it does not work on the game once it is built. I tested some stuff modifying the scripts but what I found out is that the code stops working when it comes to Initializing the database. This is the piece of code:
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
var dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available)
{
if (task.IsCompleted)
{
reference = FirebaseDatabase.DefaultInstance.RootReference;
if (LoadsData)
{
GetScores();
}
}
}
else
{
Debug.LogError(string.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
}
})
The script stops when I call this method, and obviously the saving and loading data methods won't work as well.
The project is PC platform and I am using Unity 2019.4.17f1.
If I didn't explain myself well, feel free to ask. I hope I can get some help with this!
Upvotes: 2
Views: 1647
Reputation: 36
For now firebase's unity sdk only supports Android and Ios app development on pc. Desktop projects are on beta version. You can find down below what you can use in desktop project for now. https://firebase.google.com/docs/unity/setup#:~:text=The%20Firebase%20Unity%20SDK%20includes,Windows%2C%20macOS%2C%20and%20Linux. Your problem is probably this: "Caution: Firebase Unity SDK desktop support is a beta feature. This feature is intended only for workflows during the development of your game, not for publicly shipping code."
Upvotes: 1