firebase-unity-sdk
firebase-unity-sdk copied to clipboard
Editor freezes more than usual when hitting play.
Please fill in the following fields:
Unity editor version: 2019.3.7f1 Firebase Unity SDK version: 6.13.0 Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage Firebase plugins in use (Auth, Database, etc.): FirebaseMessaging.unitypackage Additional SDKs you are using (Facebook, AdMob, etc.): None Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows 10 Platform you are targeting (iOS, Android, and/or desktop): Android Scripting Runtime (Mono, and/or IL2CPP): Tried both
Please describe the issue here:
(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)
Everytime i hit play (even on a empty project), Unity takes too long to build, compared to the usual time, this is not practical for me. Also, when the game starts (the play button becomes blue), the editor completely freezes for a few seconds as if it was compiling the game once again. Am i doing something wrong ?
To easily reproduce this issue:
- Create a empty 3D project
- Switch to Android Platform in the build settings
- Import FirebaseMessaging.unitypackage from Assets -> Import Package
- After import, a popup shows up to enable Android Auto-Resolution, click "Enable"
- The Unity Packager Manager Resolver window opens, click "Add selected registries"
- Wait until all dependencies update.
- Don't add anything else, and hit "Play"
- You will notice the editor freezing and taking way too long to build.
This problem happens even if you don't have any base code running. Also, tried adding the google-services.json, but it doesn't do anything in this case.
Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes, the exact same thing happens here, and it feels worse.
What's the issue repro rate? (eg 100%, 1/5 etc) 100%
Hi @axelbau24 ,
Thanks for your report!
You've done everything right so far, but I've been unable to replicate the issue on my end. Can you tell me if you see any windows, dialogs, &c pop up after the first time you hit play (screenshot them if you like/can)? Do you see anything interesting in your Console window/would you mind sharing your Editor log?
(note that if you don't feel comfortable sharing your Editor log publicly, you can file a bug here and link this issue/say you're trying to add information for this bug).
Is there anything else of interest that you can think of in your setup? Are you using meta files? A version control system other than Git? Is part of your unity project readonly or stored on a synced volume (ex: Dropbox, iCloud, &c)?
I'm checking in with the rest of the team to see if there's anything else we need to verify.
Thanks, --Patrick
I have similar experiences with Firebase Core and Analytics. If I remove them from the project then everything goes back to normal. I doubt that this would make any difference, but I used External Dependency Manager for Unity (EDM4U) and Unity Package Manager to install the packages.
Nothing is synced in the background for my project, it is a fairly straightforward setup. Code generation is set to .NET 4.x and IL2CPP, but changing the setting to Mono makes no difference.
A similar delay also happens when I switch from my code IDE (JetBrains Rider) to Unity editor, if there was any change on the source code and it is recompiled in the background Unity editor stops responding for a good 15-20 seconds.
I have tried profiling the editor to figure out what is going on. I am no expert on Unity profiling, but as it seems to me when this delay happens then profiler stops capturing anything until the editor starts working again.
Please let me know if there was any other information I could provide.
I have attached the editor log from the moment I press the play button: editor_log.txt
This line looks rather suspicious to me:
Unloading 534 unused Assets to reduce memory usage. Loaded Objects now: 5522.
Total: 15.606300 ms (FindLiveObjects: 0.836300 ms CreateObjectMapping: 0.170500 ms MarkObjects: 13.140400 ms DeleteObjects: 1.457900 ms)
Edit: nevermind, I just realised it is msecs. :)
I might have the same issue. Looking at the editor profiler, there is at least one entry that seems suspicious to me:
Note that I'm running on Windows 10. I can't say for sure if that XCodeProjectPatcher is related to firebase, but looking through some results on google it seems to be the case. But this seems to be a specific thing for IOS, so why is it running on my windows environment? It seems to be responsible for at least 4s of startup time.
I'm using Firebase 6.13, auth, database and analytics. And google admob. Running on SSD.
Exact same issue mentioned by MateusMP. It takes almost 4-5 seconds to enter play mode in the empty project with just Firebase core installed from package manager.
I am running Unity on Windows too, maybe this is an important piece of information.
Thank you for your answer @patm1987
Here's my Editor Log Editor.log
Also, noticed some iOS stuff happening, even though i'm just compiling for Android, just like @MateusMP did, In my case i don't see anything related to XCode, just the iOS resolver (which i don't think it should be there and also taking a long time to compile.
Is there any way to disable this iOS resolver?
EDIT: This was a completely empty project stored on my PC, no version control or cloud were used.
I'm having a similar symptom (8 second slowdown right after entering playmode). Platform is set to Android. Same Unity and SDK version as original poster. I have also tried disabling all auto-resolve functions in the package, but this seems to get called no matter what. This is a critical issue.
Using Google Analytics for Firebase, Firebase Core, and Firebase Cloud Messaging.
I have the same issue. Freezes at 10-15 seconds on press play button.
Unity 2019.2.21, Firebase 6.12.0 and 6.13.0
The majority of this slowdown appears to be due to the Google Play Resolver / External Dependency Manager. When removed, the slowdown goes away. Of course, Firebase won't load so you'll need to add it in again before you build - and this option only works when using the manual install because if you're using Firebase unity packages it will not let you uninstall the EDM because the firebase libraries rely on them.
@GorillaOne How do I remove that? Thanks!
I have the same issue. Freezes at 10-15 seconds on press play button.
I’m having the same issue, but on top of this the editor freezing for 20seconds after each code save. It’s getting unbearable. What would normally take me 2 mins to do, takes 3-4x as long.
I also tried a vanilla build using a brand new project and only adding firebase - same issue.
Anyone else experiencing delays between code changes and then switching over to the editor (even with out play)?
I believe this is the same issue as in firebase/quickstart-unity#644
I believe this is the same issue as in firebase/quickstart-unity#644
I think you are right - I was looking at firebase/quickstart-unity#644 earlier and sounds very similar.
The issue is still present in 6.14.0, EDM version 1.2.153.
As a workaround for those using the Package Manager versions, you can simply delete the Editor folder and Editor.meta file within Library/PackageCache/[email protected]/ExternalDependencyManager
. You may have to do it every time you start Unity.
You'll sometimes get an error message about failing to load Firebase.Editor.dll, but it seems you can safely ignore it.
The issue is still present in 6.14.0, EDM version 1.2.153.
As a workaround for those using the Package Manager versions, you can simply delete the Editor folder and Editor.meta file within
Library/PackageCache/[email protected]/ExternalDependencyManager
. You may have to do it every time you start Unity.You'll sometimes get an error message about failing to load Firebase.Editor.dll, but it seems you can safely ignore it.
The issue is still present in 6.14.0, EDM version 1.2.153.
As a workaround for those using the Package Manager versions, you can simply delete the Editor folder and Editor.meta file within
Library/PackageCache/[email protected]/ExternalDependencyManager
. You may have to do it every time you start Unity.You'll sometimes get an error message about failing to load Firebase.Editor.dll, but it seems you can safely ignore it
What would be the downside of this? Would it be that you can’t add any new firebase packages or does the dependency manager get re-added (and that’s why we need to remove each time?)
What would be the downside of this? Would it be that you can’t add any new firebase packages or does the dependency manager get re-added (and that’s why we need to remove each time?)
You lose all firebase editor-specific functionality, but you can restore the folder when you actually need the functionality, and keep it removed when you don't. I assume you need it for building, resolving dependencies, probably for installing or removing packages too.
Obviously not ideal but I think it's a serviceable workaround for now, until this issue is fixed.
Same issue here! When I play a scene, music starts to play but all graphics and the unity editor are frozen for a couple of seconds. I can confirm this happened only after adding Firebase Analytics (Android + iOS) to my project.
Unity 2019.3.10f1, Firebase 6.14.0
Deleting this folder: Library/PackageCache/[email protected]/ExternalDependencyManager
does NOT solve the issue. It is a problem with Firebase and not EDM.
The only workaround I was able to figure out is to remove Firebase from the project while I edit it and put it back when I create a new build.
@almosr The workaround I posted definitely solves it for me. Maybe it's two different issues, or our environments are different somehow.
A reminder just in case, Unity restores the folder when you open the project, so you have to delete it when the project is already open.
@ideka When I deleted that aforementioned folder while Unity is open then the issue disappears, because Firebase fails to initialize. Unity keeps throwing various errors, I would rather recommend to remove Firebase from the dependencies, that is a cleaner way to workaround the issue.
@ideka Thanks! I can confirm that this works for me (and yes, it shows the Editor error), but everything else seems to work fine (fireauth, firestore, cloud functions). I can live with this hack for now :D
@almosr I could, but I'm already fairly far along with firebase
@almosr Removing EDM while working in the project works for me as well. As mentioned above, Unity regenerates the EDM when you open the project and when you open the Package Manager.
If you don't need firebase, then removing firebase is an excellent option. However, I'm assuming that the folks here, like myself, who have this problem need firebase. Removing the EDM when you open the application prevents the slowdown because it prevents the Firebase editor scripts from running, which is where I believe the issue is located. It's not great, but its just a workaround until they fix it.
Not sure if it's already been made explicit or not, but I've been working on the same project in the Windows 10, OS X, and Linux versions of Unity, several different versions, and this only seems to happen on Windows (all 2019 versions I've tried), so you'll have trouble reproing on GLinux or Mac.
My workaround is to locally delete Firebase.Editor.dll and its meta file, and the issue goes away (but I don't commit or it breaks our game in CI builds), but if that dll is anywhere in even an otherwise empty project, things get slow. This has been happening since at least January, and in particular before the migration to the Unity package manager install, so it's not a particularly new change that's caused it.
For me it's also crippling slow with Unity 2019 and Windows10. However it seems like deleting the editor.dll doesn't bring any noteworthy improvement. Startup times are around 20 seconds and also freezes if I change anything in vs code and come back to unity.
Basically impossible to work like this.
Seems firebase/quickstart-unity#667 is duplicate of this one. The problem seems very straight forward:
-
GenerateXmlFromGoogleServicesJson
class has a[InitializeOnLoad]
attribute so Unity will load it and execute its static constructor after each recompile and when entering play mode. - Static constructor will schedule
CheckConfiguration()
to be called on first next Update, - which will then call
UpdateConfigFileDirectory()
- which will for every "google-services.json" and "GoogleService-Info.plist" file in project call
ReadBundleIds(file)
- which will run "generate_xml_from_google_services_json.exe" on Windows and "python generate_xml_from_google_services_json.py" on other platforms and each invocation of that takes more than 5 seconds, keeping the Editor frozen.
Surely Firebase doesn't need to do all this on each load so please just cache it somehow or something so we can continue making games :)
You can speedup recompile time by removing 'generate_xml_from_google_services_json.py'. After that you will see error message on each recompile. But that's ok. Also you have to restore this file before 'platform build'.
You can speedup recompile time by removing 'generate_xml_from_google_services_json.py'.
I've tried that but Unity will restore it pretty quickly in my case.
I think it restores 'generate_xml_from_google_services_json.py' on Unity restart. Can be solved with simple Unity script which only responsibility is to delete it.