- Home /
Using firebase. How to get the most out of speed?
I can see position values update almost instantly in firebase but there seems to be a large a building delay when I get the values.
I use this in the void Start() for the object to be moved;
void StartListenerX(){
dat.Child("Vect_X").ValueChanged += (object sender, ValueChangedEventArgs args) => {
if (args.DatabaseError != null) {
Debug.LogError (args.DatabaseError.Message);
return;
}
float xx = float.Parse (args.Snapshot.Value.ToString ());
toPosition = new Vector3 (xx, transform.position.y, transform.position.z);
};
}
void StartListenerZ(){
dat.Child("Vect_Z").ValueChanged += (object sender, ValueChangedEventArgs args) => {
if (args.DatabaseError != null) {
Debug.LogError (args.DatabaseError.Message);
return;
}
float zz = float.Parse (args.Snapshot.Value.ToString ());
toPosition = new Vector3 (transform.position.x, transform.position.y, zz);
};
}
and I use this when writing / sending the position
if ((lastpos - transform.position).magnitude > 2f) {
posUpTimer += Time.deltaTime;
if (posUpTimer > .25f) {
posUpTimer = 0;
dat.Child ("Vect_X").SetValueAsync (transform.position.x);
dat.Child ("Vect_Y").SetValueAsync (transform.position.y);
dat.Child ("Vect_Z").SetValueAsync (transform.position.z);
lastpos = transform.position;
}
}
even though I space out writing / sending the delay builds the longer the game is running.
Answer by raymondjohnsonjr01 · May 22, 2018 at 10:38 PM
Hi everyone! I was having a hard time choosing a good backend service for my apps, so just wanted to share my experience with you on that. Having some apps both at Google Play and Appstore, I used Parse until Facebook decided to shut it down. So, I was forced to search for alternatives and, to be honest, was not that happy as most of them didn't fit my requirements as nicely. Firstly, I checked Firebase, but it's very limited in querying and indexing working on a nonSQL ecosystem with the database being a giant JSON doc. Then, it was AWS and Appery, both are not user-friendly and become rather expensive in no time. My next try was Kinvey, and it's super expensive once you start doing something complex. I needed system to support social login, like Facebook, Twitter, Google, geolocation, and push notifications for both iOS and Android, so my final try was Backednless, I started for free and was able to figure out how to use it a lot faster than before, since support is pretty fast to answer. So far, it fits all of my needs and functionality is on point. Hope this helped.
Answer by DavidSWu · Oct 23, 2018 at 03:27 AM
I am not sure if I understand. Are you comparing the Backednless SQL database offering to Firebase Realtime? They are designed to solve different problems.
Your answer
![](https://koobas.hobune.stream/wayback/20220612144410im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Code Wont Work? 0 Answers
Questions about Multiplayer and Networking? 1 Answer
What do I need to implement web-server for multiplayer without Unity services? 2 Answers
Best method of multiplayer? 0 Answers
Unity Multiplayer Oyun Yapma 0 Answers