How do I delete my Auth object before "the App it depends upon" when Changing Scenes?
Asked Answered
R

1

10

So, utilizing Firebase Auth and Storage in my AR Application. Upon completing Login and Asset Bundle download, my script directs the User to the next Scene (via SceneManager.LoadScene()), where they can interact with their content.

However, upon scene shift, this Error causes a Pause in-editor on an inconsistent basis:

ApplicationException: Auth object 0x7586a0f0 should be deleted before the App 0x77b799a0 it depends upon. Firebase.FirebaseApp.ReleaseReferenceInternal (Firebase.FirebaseApp app) (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:998) Firebase.FirebaseApp.RemoveReference () (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:293) Firebase.FirebaseApp.Dispose () (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:51) Firebase.FirebaseApp.Finalize () (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:47) UnityEngine.UnhandledExceptionHandler:m__0(Object, UnhandledExceptionEventArgs)

How do I go about deleting my Auth object before the scene shift? I've tried auth.Dispose() and auth.SignOut(), no luck.

Rebirth answered 25/3, 2019 at 16:23 Comment(2)
It's storage for me, but same issue. If I stop playing before the cloud fetch finishes, Unity crashes with the error above. If I don't dispose of the FirebaseApp, then I don't crash.Greenaway
Is this still going on? Are you manually disposing of the FIrebase app? If so, why? Please post the full code context with identifiable details redacted.Antheridium
L
0

It's difficult to see the exact problem without seeing the code.

Regardless, I suspect the issue lies with the fact that most Auth API calls will happen asynchonously which means that code that is stated after the API call will possibly run before the API method is finished executing.

Perhaps you should make the encapsulating method asynchronous and then yield the completion of the API call before loading the scene.

Otherwise, if it is not so important that this finishes before the scene is loaded and you have the performance overhead, perhaps load the scene additively then only unload the previous scene once the auth obj is destroyed.

PS. If this still hasn't helped you, then please add your code to the question to help us help you.

Lorin answered 15/11, 2023 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.