Comments (21)
Hi @Havard-SL,
I tested this using C++ library on desktop, Unity library on desktop and Unity library on Android and got the same output each time for my test: DataSnapshot { key = test, value = 3.14156 }
.
Are you able to provide a screen shot of your firebase database console showing the data you have?
Are you able to use GetRawJsonValue
and dump the correct value in json?
Edit: One thing to note is I was using the latest release 6.7.0 and not 6.6.0.
Edit 2: Can you please turn on verbose logging and check to see what value is sent on the wire.
Add this to the start of the start function:
FirebaseApp.LogLevel = LogLevel.Verbose;
FirebaseDatabase.DefaultInstance.LogLevel = LogLevel.Verbose;
Should see this log line:
[pc_0] handleServerMessage d {"d":2.69,"p":"test"}
from firebase-unity-sdk.
Thank you for your quick response, and sorry for my slow response!
First of all, I updated my firebase SDK to version 6.7.0, but the issue still persisted.
I am not sure if I implemented it correctly but GetRawJsonValue just gave me "2" in the debug log,
And lastly, weirdly enough, the log line I got was reading:
[pc_4] handleServerMessage d {"d":2,"p":"test"}
Thank you for trying to help me, I really appreciate it!
from firebase-unity-sdk.
That message you replied with is the raw response Firebase gets over the wire. Thus it looks like the data stored in Firebase real time database is an integer not a double and thus not a problem with the SDK. Please check the logic you use to save the values and ensure types are correct for storing floating point numbers (should be using double).
from firebase-unity-sdk.
I have attached a picture of my firebase realtime database and unity side by side:
Here you can see that I have stored the variable as a float, and my only database rules are:
{
"rules": {
".read": true,
".write": false
}
}
I have no clue why this happens, any help would be appreciated!
from firebase-unity-sdk.
from firebase-unity-sdk.
Hi @Havard-SL
Could you provide more logs? Yo can find your Editor log here
https://docs.unity3d.com/Manual/LogFiles.html
Also, the snippet of code about how you call into database API would be very helpful.
Here is what I read from your screenshot.
There is a mysterious request 1 sent before the listen request.
Then there is a listen request 2
And the response for mysterious request 1 is received with value 2 at "test". This seems to trigger the listener with value 2 and removed the listen id.
When response for request 2 is received, it cannot do anything. And I cannot see what the actual response message is from your screenshot.
I suspect you might have done something like but I cannot confirm with your screenshot.
ref.SetValueAsync(2);
ref.GetValueAsync().ContinueWith(task => {
Debug.Log(task.Result);
});
So, please provide more information. Thank you!
from firebase-unity-sdk.
Hey @Havard-SL. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
from firebase-unity-sdk.
I am extremely sorry for the late response, but thank you all for trying to help!
I've been busy studying for a final, so I had to focus on some other things, but I would be happy to answer any questions now!!
@chkuang-g Ive made a gist of my Editor.log placed in my ~/.config/unity3d/ folder:
https://gist.github.com/Havard-SL/c7fa8d760ec403c4373c6315af63815f
The current code I'm using to access the realtime database right now is almost the same as the one in my original issue description:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Firebase;
using Firebase.Unity.Editor;
using Firebase.Database;
public class test: MonoBehaviour {
void Start() {
FirebaseApp.LogLevel = LogLevel.Verbose;
FirebaseDatabase.DefaultInstance.LogLevel = LogLevel.Verbose;
// Set thistask before calling into the realtime database.
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://unity-test-9f7cc.firebaseio.com/");
DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Aigt imma head in");
FirebaseDatabase.DefaultInstance
.GetReference("test")
.GetValueAsync().ContinueWith(task => {
if (task.IsFaulted) {
// Handle the error...
Debug.Log("Error");
}
else if (task.IsCompleted) {
DataSnapshot snapshot = task.Result;
// Do something with snapshot...
Debug.Log(snapshot.GetRawJsonValue());
}
});
}
}
This is almost directly copied from the Unity firebase starter guide, but including all changes people have suggested here.
If you want more screenshots I would be happy to share, but I dont know what part of the console output contains the relevant information!
I am very grateful for your help!
-Håvard
from firebase-unity-sdk.
Since there haven't been any recent updates here, I am going to close this issue.
@Havard-SL if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
from firebase-unity-sdk.
This is definitely odd.
For what it worth, we actually fixed whole load of database editor issues in 6.7.0. Also 6.8.0 is out too.
https://firebase.google.com/support/release-notes/unity#version_670_-_november_13_2019
Could you try to download the latest version and see if that fixed your issue?
Also, I'll try to run your code with 6.6.0 next week and see what I can find.
Shawn
from firebase-unity-sdk.
Thank you for informing me of the new update. However, it did not work. On the contrary I get two new errors:
Error: Could not load signature of Firebase.Editor.XcodeProjectModifier:get_Project due to: Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none>
But as I'm not testing or planning to build this on iPhone, this is most likely irrelevant.
The other one:
Unloading broken assembly Assets/Firebase/Editor/Firebase.Editor.dll, this assembly can cause crashes in the runtime
I have no clue what this means. I did not see these in any of the previous firebase sdk versions.
I just thought I should mention them in case they were relevant to this problem.
Something I haven't mentioned previously, but could be useful is that i didn't have this issue previously, but it appeared after a while. The only thing I can think of that could have made a difference is a rouge config (however, I have this issue on two different machines, so it would be unlikely, but still possible), or the messing around with libssl.1.0.2 to circumvent the above mentioned issues.
I work with a fellow student who runs arch linux, but he does not have this problem, on the other hand, since I run ubuntu, there should be more bug reports similar to mine, as it is a more popular distrobution.
Thank you for trying to help me!
-Håvard
from firebase-unity-sdk.
Oh boy, that looks like a regression in 6.8.0.
Could you try 6.7.0 and see if that is fixed?
Another question: I saw you were trying to set Editor Database Url
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://unity-test-9f7cc.firebaseio.com/");
Is this different from the one from google-services.json?
I'm trying to reproduce this on Linux machine.
from firebase-unity-sdk.
Alright, tried to modify the quick-start , change UIHandler.cs to call GetValueAsync() like you did, imported 6.6.0, and ran on a Linux machine. Got a solid 2.69.
// Initialize the Firebase database:
protected virtual void InitializeFirebase() {
FirebaseApp app = FirebaseApp.DefaultInstance;
StartListener();
isFirebaseInitialized = true;
FirebaseApp.LogLevel = LogLevel.Verbose;
FirebaseDatabase.DefaultInstance.LogLevel = LogLevel.Verbose;
FirebaseDatabase.DefaultInstance
.GetReference("test")
.GetValueAsync().ContinueWith(task => {
if (task.IsFaulted) {
// Handle the error...
Debug.Log("Error");
}
else if (task.IsCompleted) {
DataSnapshot snapshot = task.Result;
// Do something with snapshot...
Debug.Log(snapshot.GetRawJsonValue());
}
});
}
I really wonder if you were connected to the right database... 😂
Could you try to do the same with quickstart and add your google-services.json to the project as well?
Also, very curious, if you change the value to, say 7.77, do you get 7 as a integer on your client?
from firebase-unity-sdk.
Thank you for your response, @chkuang-g !
I have reinstalled my entire operating system (Still ubuntu 19.10) and launched unity hub using a flatpak, so that I don't have installed libssl 1.0.2 manually as mentioned before, and it just worked fine (except for the lowermost error you can see on the picture below).
I tried changing the value in the database to 7.77 as you said, and got 7 as my output!
I used the same code as I wrote in my original post, but I can try to change the example code, like you did if you want!
If I put quotation marks around the values, I get the correct response:
Thank you!
-Håvard
from firebase-unity-sdk.
I'll dig more about this issue with our RT DB backend.
At the meantime, in order to fix those error message you saw about "Unload broken assembly", we just release a patch 6.8.1 which should resolve that. Not really related to your original issue though.
from firebase-unity-sdk.
Happy new year and sorry for the late reply.
We had a hard time to reproduce the same issue on our Linux/Window/Mac machines. This seems to be an unique issue to your machine since no other people has reported the same issue yet. However, based on your log and our tests, we narrow down the potential place which was causing the issue.
Long story short, it does not seems to be a server issue but the problem when the client is parsing the data here.
https://github.com/firebase/firebase-cpp-sdk/blob/master/database/src/desktop/connection/connection.cc#L310
Since we cannot reproduce the issue, we would need your help to root the cause. And the first step is to confirm our assumption.
Could you download this custom build FirebaseDatabase plugin, import it, run your game and paste the log here?
You should see some logs start with "JsonToVariant:" and "FlexbufferToVariant:". Basically this custom build is just trying to log the message your editor received from the database server and print out the parsing process.
Thank you!
Shawn
from firebase-unity-sdk.
Happy new year, @chkuang-g ! And thank you for sticking to this issue!
I made a new gist of the Editor.log after trying the new DLL in a new clean project, as just copying the logs from inside the unity editor proved extremely cumbersome:
https://gist.github.com/Havard-SL/211f5e913c5061d0c047de911155f972
I have also noticed that at the top of the log it still says "No usable version of libssl found", which is kind of weird considering I am using unityhub from a flatpak and the project runs fine (except for the bug, of course)
On the positive side there are a ton of those JsonToVariant and FlexbufferToVariant, so at least I imported the DLL correctly!
Thank you so much for helping, and if there is anything else I can do to help please inform me! :)
from firebase-unity-sdk.
Hi @Havard-SL
Thanks for the log. This confirms that something is wrong during the parsing.
https://gist.github.com/Havard-SL/211f5e913c5061d0c047de911155f972#file-editor-log-L4562
https://gist.github.com/Havard-SL/211f5e913c5061d0c047de911155f972#file-editor-log-L4674
One thing we noticed was that it showed "7,000000" which uses comma instead of dot. I assume your machine's global locale is not "en_US.utf8". This might be the reason why the parser failed, since it is expecting a comma when parsing "7.77".
One potential fix could be setting the locale to ""en_US.UTF-8". Ex.
$ export LANG=en_US.utf8
You can use locale -a
to check if the locale is supported.
At the meantime, we are trying to figure out how to make this independent from the locale.
Thanks for reporting this!
Shawn
from firebase-unity-sdk.
Thank you so much, @chkuang-g and everyone else who helped!
Using export LANG=en_US.utf8
fixed the issue, since my current LANG was nn_NO.UTF8
I would never have expeced that to be the issue, thank you so much for helping!
Should I leave this issue open until a permanent fix is pushed?
Again, thank you so much for all your help, you're doing an amazing job!
-Håvard
from firebase-unity-sdk.
Glad that it works for you.
Please leave this issue open. We will close it once we release a patch for this.
from firebase-unity-sdk.
This issue should be fixed in 8.7.0. Close for now and if it still appears, please reopen.
from firebase-unity-sdk.
Related Issues (20)
- [Bug] iOS crashes when Google sign in is not enabled HOT 2
- [Bug] SignIn With Facebook Exception: Bad access token: {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"} HOT 2
- [Bug] SIGSEGV - Pure virtual function called! HOT 9
- [Bug] SIGSEGV - firebase::Mutex::Acquire() HOT 2
- [Bug] SIGSEGV - FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x<sanitized>) HOT 2
- [Bug] AppCheck fails in debug environment with Firebase 11.9.0 HOT 12
- [Bug] Undefined symbol errors with Firebase SDK v 11.9.0 HOT 1
- [Bug] FirebaseCore_Privacy.bundle not found HOT 14
- [Bug] Unity Editor crashes due to Firebase Core SDK in MacOS. HOT 3
- UnityEditor.AndroidManifest.SetFixedWindowSize Error on build when Firebase Messaging is added HOT 4
- [Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_8_1' HOT 5
- Firebase SDK Validation Failed in Unity (Break Symlinks) HOT 10
- [Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_8_1' occurs only on iOS builds HOT 4
- [Question] When is the release of the version incorporating firebase-ios-sdk v10.24.0 expected? HOT 3
- [Question] Firebase XCFrameworks are not codesigned HOT 5
- [Question] macOS version does't store player credentials after game quit. HOT 9
- [Bug] Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. HOT 7
- [Bug] AnalyticsFixPropertyRemover for Unity 2021 HOT 4
- [Bug] iOS Build crashing on second launch when made with Xcode 15.3 HOT 4
- [Question] Firestore throws "Cursor has too many values" exception when running an aggregate count query that starts at a specific document HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-unity-sdk.