Errors when accessing Firebase Realtime Database in Unity: could not connect, Unknown host

4

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:

  • I've changed the rules of my database, both write and read set to true
  • I'm building for iOS and Android platforms
  • Operating System: Mac OS 10.14.3
  • Unity Engine version: 2018.3.8f1
  • Firebase SDK version: 5.5.0
  • Scripting Backend: Mono
c#
firebase
unity3d
firebase-realtime-database
asked on Stack Overflow Mar 11, 2019 by Auriel X • edited Mar 12, 2019 by Auriel X

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0