Search Issue Tracker

Won't Fix

Votes

0

Found in

2017.4.0f1

2018.4.0f1

2018.4.4f1

2019.2.0a1

2019.3.0a1

Issue ID

1173832

Regression

No

Editor freezes when entering Play mode and Firebase GetValueAsync() was used in the last Play mode

Mono

-

How to reproduce:
1. Open user attached project "FirebaseTestProject.zip"
2. Open "SampleScene" scene
3. Enter Play Mode
4. Click the "Click" button in the Game View
5. Wait about 30 seconds
6. Exit Play Mode
7. Enter Play Mode

Expected result: Play Mode starts
Actual result: Editor freezes

Reproducible with - 2017.4.30f1, 2018.4.6f1, 2019.2.1f1, 2019.3.0a12
Couldn't test with - 2019.1 (Firebase throws errors)

Notes:
Not always reproducible, it looks like you have to wait for some time (30 sec to 1 minute) in Play Mode first for this to reproduce.

  1. Resolution Note:

    Responded to user, pretty sure not something we can fix.

Comments (6)

  1. JNectar

    Jun 11, 2022 04:13

    Maybe this error happens because unity tries to set the reference to the variable in the first frame, without having the reference information.
    So, create a function to assign the FirebaseDatabase.DefaultInstance.RootReference after a short period of time. Like this:

    void Start()
    {
    StartCoroutine(LateStart(1));
    }

    IEnumerator LateStart(float waitTime)
    {
    yield return new WaitForSeconds(waitTime);
    dbReference = FirebaseDatabase.DefaultInstance.RootReference;
    }

  2. PedroGomas

    Apr 12, 2021 13:57

    Hi , solved my problem with a simple thing, instead use a variable "DatabaseReference reference" and next equals FirebaseDatabase.DefaultInstance.RootReference, use directly in the code to save data like this - >

    FirebaseDatabase.DefaultInstance.RootReference.Child("Users").Child("user1").Child("email").SetValueAsync(emailRegisterField.text.ToString()).ContinueWith(task =>
    {
    if (task.IsCompleted)
    {
    Debug.Log("SUCESSO");

    }
    else
    {
    Debug.Log("já foste");
    }
    }

  3. Guggilla

    Aug 19, 2020 07:58

    If you are using a Default instance it's gonna struck even I experience.

    So best way is instead of using default use
    Firebasesatabase. Getinstance(app )

    The app is the firebaseapp which we created at start by using and checking analytics.

    This worked for me.

  4. HashbangGames

    Dec 31, 2019 16:26

    There is no solution because it's not a Unity issue. I've had this same problem and often the issue is that you have not properly closed the connection in firebase.

    OnApplicationQuit()

    - Any .ValueChanged subscriptions must be cleaned up
    - call `FirebaseDatabase.DefaultInstance.App.Dispose();`

    If you've properly cleaned up and disposed the firebase connection then the Unity Editor does not hang.

  5. martinasenovdev

    Nov 06, 2019 11:29

    we're having the very same problem.
    Please share more info as to what the solution is and why you cannot fix it?

  6. unnanego

    Sep 06, 2019 14:21

    Why won't fix?!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.