quickstart-unity: Unity Editor (2018.3) crashes using Database v5.4.4
Unity editor version: 2018.3.5f1 Firebase Unity SDK version: 5.4.4 Additional SDKs you are using (Facebook, AdMob, etc.): empty project with Firebase only Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac Platform you are targeting (iOS, Android, and/or desktop): iOS
Please describe the issue here:
The 1st problem I met implementing Database is that WebSocket errors appear after Database initialisation. Here is an issue described and solution I used to make it run in Editor: https://stackoverflow.com/questions/50651865/unityfirebase-databaseerror-websocket-ws-0-could-not-connect
That helped to solve WebSocket issue, but another has appeared. It’s very similar to that one - https://github.com/firebase/quickstart-unity/issues/200
Very easy to replicate - set database url, call database update request, something like
FirebaseDatabase.DefaultInstance.RootReference.Child(subDatabase).Child(key).SetRawJsonValueAsync(jsonString);
Press Play and call the method. Stop, and Play again - Editor crashes or freezes.
That problem don’t allow to use Firebase at all… Wasted so much time trying to find the solution but nothing. How you “Firebase dev team” even can release such SDK’s?! Shame
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 20 (5 by maintainers)
I have this problem with mac os with unity 2019.1.10 and Firebase 6.3.0 In play mode everything is ok, but as soon as I stop, Unity crashes. No other errors.
Why is this closed? Unity crashes here also With settings: Firebase.Database in Mono: Editor-Enabled in Plugins: Editor-Disabled Result- Crash when running.
Second scenario- in Mono: Editor-Disabled in Plugins: Editor-Enabled Catch error when “reference = FirebaseDatabase.DefaultInstance.RootReference”
I use .net 4 scripting and can’t revert because I need it for my script.
Edit: I reverted back to Firebase 5.4.4 (from 5.5.0), the problem is gone. Please report it as a bug. I won’t upgrade til the problem is fixed.
Seems logical that the general network configuration has little to do with this issue. In my case I can get my old clunky windows 10 pc to behave as expected, and my mac just wont, both sitting behind the same router. After exhausting the different local network security settings I found on my mac, I finally found a workaround that seems to be productive: In the Unity Editor settings: set “scripting runtime version” to 3.5 (deprecated) “scripting backend” to Mono and “API compatibility level” to .Net 2.0. This way I can connect to the db more than once.
Firstly, @fingerfunkNIK in particular I didn’t mean to insult anyone here. I’m just making it clear that we have a RT DB C# implementation that is enabled by default and should not be hacked to use the desktop C++ implementation (we have C#–>C++ proxy DLLs that are used on mobile) since it’s known to not work.
Now perhaps I can explain a bit more about what is going on then folks can ask their IT admins about this. Connections to the Realtime Database (RT DB) - when doing anything that involves the full protocol - requires Websockets secure (specifically the wss:// scheme). It’s possible to connect to the RT DB using REST but many features are not supported. The RT DB C# implementation - similar to Android & iOS - uses Websockets for connections. This is typically fine as most modern proxies and load balancers don’t modify data flowing between the Websockets client and the RT DB server. However, in some cases a HTTP proxy or L7 load balancer will break the websocket connection, for more information see this article by Peter Lubber, who just so happens to now be a fellow Googler and this Wikipedia article.
The reason why the C++ RT DB implementation when applying the hack mentioned in this stackoverflow response “kinda” works is that it uses a REST connection to the RT DB and is pretty seriously hobbled by this. We put together a client that only uses a REST connection to get something, anything for C++ developers to use when debugging on desktop. We’ve been working on switching the RT DB C++ implementation to use websockets throughout similar to our mobile implementations and should have something ready soon. So we’ll likely consistently see connection issues due to badly configured software / hardware everywhere.
Now there’s the background, but how to solve the issue? After a quick hunt around the web (thanks Google) I discovered that many web applications run into similar issues including Slack. Slack has a really nice debugging guide here that can be applied to the RT DB. The only difference is that the hosts that will need to be whitelisted are
*.firebaseio.com
.Folks, please let us know whether this resolves your issue.
Well, since the connection works fine in c# on the windows side, “Instead you should check your network configuration to see what is blocking the websocket connection from the C# implementation (currently the default one before the workaround is applied) and use that instead.” Is a pretty insulting comment