Hang whilst entering play mode or quitting Unity

Hi all,

I regularly have to force quit Unity with Task Manager because it hangs whilst entering play mode or exiting Unity with the X in the top right corner. By “hangs” I mean:

When entering playmode - the play button is in its light grey state, there is no progress popup and we never enter playmode.
When quitting - a progress popup is visible but it never closes (after waiting up to 30 minutes).

Interestingly when this happens I can still attach the debugger and, once attached, if I pause execution it is almost always in localisation code. I have attached a screenshot of the stack of them most common place it seems to pause at whilst entering playmode.

The HugeLocalisedString.GetLocalisedString() method is just a wrapper around LocalizedString.GetLocalizedString().

Any ideas on how to fix/debug this?

Unity version 2020.3.23f1
Package version 1.0.5

Cheers,
Andy

It looks like it’s because it’s using WaitForCompletion. This forces addressables to complete immediately and can be slow if it needs to load a large amount of assets. If it’s freezing the editor then it sounds like it could be a bug. Could you please file a bug report with an example project so we can figure out what’s going wrong?

Thanks, I will submit a bug report if I can get a reliable repro. In the mean time is there anything I could provide you which might help narrow it down so I could get closer to a repro?

You are right in that we don’t use the async methods, we just use GetLocalizedString which does GetLocalizedString.

Cheers,
Andy

It seems to be stuck in the resource manager which is addressables code. What playmode do you have enabled for addressables? It’s in the addressables group window toolbar.

I have “Use Asset Database (fastest)” enabled

8186607--1066710--upload_2022-6-7_13-6-25.png

Ah in that case im not sure what the problem could be. Hopefully, you can get a reproduction. :slight_smile:

I just ran in the same issue. Infinite
8243703--1078293--upload_2022-6-30_13-28-48.png

Unity version 2020.3.15f2
Localization 1.0.5
Addressable 1.19.19

my addressable database only has localization string tables of about 10-30 rows and 3 columns

Could you try updating to 1.3.2?

I updated to Localization 1.3.2.

I tried with both Addressable v1.19.19 and v1.20.3

Same issue

Then I finally tried updating Unity to 2021.3.0f1 and that seems to have fixed it. (of course I had to rebuild the addressables)

So I ended up with:
Unity to 2021.3.0f1
Localization 1.3.2
Addressable v1.20.3

I’m not sure if it would have worked with my previous packages version and just updating Unity, but at this point I’m not going to dig further in case it breaks again.

Thank you for the help

1 Like

Still experiencing this multiple times per day. Every time we have to kill unity and reopen which is FAR from ideal. I cannot repro in another project. Have you got any clues about what it could be from Sangemdoko saying that updating unity and the package fixed it? I am unable to update Unity or the package at the moment due to our release state.

Or even a workaround? Maybe there is there something I can input into the immediate evaluator which could unblock it. Like forcing to load something… I have no idea, just thinking out loud. Anything which would be better than a full recycle

Cheers,
Andy

Hey.
I have not heard anything about this since you last mentioned it, no other reports. Are you able to share the project so I can try and debug it? I can provide you with a link to upload it. You can DM me.

Hi @karl_jones ,

I’m finally following up on this with a tiny bit more information. I’m happy to upload our project, and I can also send a screencap video of this happening just in case you’re not able to reproduce it yourself. The project is around 63GB, so let me know where to upload this. I have tried to repro this in a new project however I cannot.

This issue seems to reliably happen when we change branch in source control to a branch where two things have happened: there have been large changes made to the localisation tables AND there have been script changes. After we have switched branch, Unity does a reimport and we find our console is full of exceptions (see below) which come from an OnValidate method in one of our localisation related scripts. This script is on lots of gameobjects in lots of different UI prefabs. This OnValidate method seems to get called for all prefabs which have this script on it when the reimport happens. I thought this could potentially be to do with this bug however we’re on 2021.3.15f1 and the bug tracker would suggest this was fixed for us. We also see these exceptions when changing branch after a fresh open of Unity (i.e. the prefabs are not loaded in memory), so I now do not think it is related to this.

So, after we’ve changed branches and Unity has reimported and spammed the console full of these exceptions. If we press play now, this is when we get the lock up that I initially reported. At this point we have to kill Unity in the task manager. However, if before we enter playmode, we reimport a single script (either with the right click menu or by making a script change), then it seems to recover and entering playmode will not cause a lock up.

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Localization.LoadTableOperation`2[TTable,TEntry].LoadTableByGuid (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] operationHandle) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Operations/LoadTableOperation.cs:79)
UnityEngine.Localization.LoadTableOperation`2[TTable,TEntry].Execute () (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Operations/LoadTableOperation.cs:61)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.19.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:469)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) (at Library/PackageCache/com.unity.addressables@1.19.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:464)
UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) (at Library/PackageCache/com.unity.addressables@1.19.19/Runtime/ResourceManager/ResourceManager.cs:452)
UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].GetTableAsync (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Locale locale) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Settings/Database/LocalizedDatabase.cs:261)
UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].GetTableEntryAsync (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Settings/Database/LocalizedDatabase.cs:510)
UnityEngine.Localization.Settings.LocalizedStringDatabase.GetLocalizedStringAsyncInternal (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, System.Collections.Generic.IList`1[T] arguments, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior, UnityEngine.Localization.SmartFormat.PersistentVariables.IVariableGroup localVariables, System.Boolean autoRelease) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Settings/Database/LocalizedStringDatabase.cs:215)
UnityEngine.Localization.Settings.LocalizedStringDatabase.GetLocalizedString (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, System.Collections.Generic.IList`1[T] arguments, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Settings/Database/LocalizedStringDatabase.cs:240)
UnityEngine.Localization.Settings.LocalizedStringDatabase.GetLocalizedString (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior, System.Object[] arguments) (at Library/PackageCache/com.unity.localization@1.3.1/Runtime/Settings/Database/LocalizedStringDatabase.cs:189)
localisation.LocalisedTMP.OnValidate () (at Packages/com.hugecalf.general/Runtime/localisation/LocalisedTMP.cs:109)

Could you try the latest version of the package 1.4.4? We have some fixes in it that may address the problems.
If its not visible in the package manager you can edit the manifest.json file in the packages folder.

I will update to 1.4.4 and keep an eye open. As we don’t have a reliable repro I cannot reliably test this without just keeping an eye open. It normally happens within a day or two so we shouldn’t have to wait too long to have an idea of if it worked

1 Like