I'm using Firebase Realtime Database to store stats in my game. I referred to their docs and wrote the following code. (I didn't want to overcomplicate anything before testing.)
using UnityEngine;
using Firebase;
using Firebase.Database;
using Firebase.Unity.Editor;
public class DatabaseManager : MonoBehaviour
{
private DatabaseReference reference;
private void Start()
{
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://#####.firebaseio.com/");
reference = FirebaseDatabase.DefaultInstance.RootReference;
}
}
Next, I attached the script to the Main Camera in an empty scene and clicked Play to test it. But I got endless errors like these:
WebSocket: ws_0 - could not connect System.Net.Sockets.SocketException (0x80004005): No route to host
WebSocket: ws_0 - WebSocketException during handshake Firebase.Database.Internal.TubeSock.WebSocketException: unknown host:
.firebaseio.com ---> System.Net.Sockets.SocketException: No route to host
I found others' workarounds online including switching to .NET 3.5, using Firebase SDK v5.4.4 instead, and disabling Firebase/Plugins/Mono/FirebaseDatabase.dll then enabling the one under Firebase/Plugins/. But none of them seemed to work for me. I need .NET 4.0 since 3.5 will soon be removed, and I couldn't find an older version of this SDK (even the magical link is invalid).
Additional Notes:
User contributions licensed under CC BY-SA 3.0