I used the Unity Localization package to localize the Font Assets and correspondent materials per local. Everything seems to work fine on runtime, but when exiting the application crashes with this stacktrace. Any idea?
MissingReferenceException: The object of type ‘Material’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Material.GetFloat (System.String name) (at <55fbbbd17b724c15b6abe8c1a3e3289c>:0)
TMPro.TMP_SubMeshUI.UpdateMaterial () (at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMP_SubMeshUI.cs:710)
TMPro.TMP_SubMeshUI.SetMaterialDirty () (at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMP_SubMeshUI.cs:617)
UnityEngine.UI.MaskableGraphic.OnDisable () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/MaskableGraphic.cs:185)
TMPro.TMP_SubMeshUI.OnDisable () (at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMP_SubMeshUI.cs:286)
Hi,
Could you please file a bug report?
I suspect the font asset is unloaded without the text system being aware of it.
Hi Karl,
That happens when exiting form the Menu, but when exiting from the Game also crashes but with a different stack (also coming since the font assets and materials are localized). Are they related?
Exception: Attempting to use an invalid operation handle
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_InternalOp () (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:460)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.GetDependencies (System.Collections.Generic.List1[T] deps) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:442) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.SumDependencyNameHashCodes (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/Utility/ResourceManagerEventCollector.cs:44) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.CalculateHashCode (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/Utility/ResourceManagerEventCollector.cs:62) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.OnResourceManagerDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext eventContext) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/Utility/ResourceManagerEventCollector.cs:142) UnityEngine.ResourceManagement.ResourceManager.PostDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext context) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/ResourceManager.cs:367) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].DecrementReferenceCount () (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:217)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:592)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:532)
UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/ResourceManager.cs:715)
UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/AddressablesImpl.cs:835)
UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/Addressables.cs:1481)
UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Addressables/AddressablesInterface.cs:82)
UnityEngine.Localization.AddressablesInterface.SafeRelease (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Addressables/AddressablesInterface.cs:47)
UnityEngine.Localization.PropertyVariants.GameObjectLocalizer.OnDisable () (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Property Variants/GameObjectLocalizer.cs:78)
It’s hard to say. We recently fixed some bugs that caused similar errors. You can try updating to the latest localization package 1.5.2. if it’s not visible in the package manager you can edit the manifest.json file in the package folder to force an update. If that doesn’t help we would need a bug report so we can debug.
Is there any other dependency that I should update to test if it works with that version of the localization package?
No just the package. If it has different dependencies then they will automatically update.
Updating to that version makes it fail directly on Play

You know, I’m going to revert all my Chinese localization and start from scratch in a different branch to see if I catch exactly where that happens and I can give you more precise information
That error message is unusual. Did you rebuild the addressables after updating? It looks like it failed to load the asset and we ended up with something null.
Are you doing any preloading?
Not doing any preloading that I know of, and I did try cleaning the cache and rebuilding with no different result.
But now I’m redoing everything from scratch, same methodology and so far it is still working. So somewhere somehow a bug was introduced that broke it completely. So I will continue redoing it and if it happens again I’ll let you know when exactly happens.
Thanks for the help
I managed to catch it when it started failing. It is one particular piece of UI, and the tables and values that reference is exactly the same as the rest of the UI. It is also no constructed different than the rest, just a collection of rects and Texts. But for some reason triggers that error on Application Exit once I try to localized any object within it.
It happens even if I only localize the string without changing the font asset or the material. But it doesn’t fail if I use the Localize String Event, only withe GameObjectLocalizer
Exception: Attempting to use an invalid operation handle
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_InternalOp () (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:460)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.GetDependencies (System.Collections.Generic.List1[T] deps) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:442) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.SumDependencyNameHashCodes (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/Utility/ResourceManagerEventCollector.cs:44) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.CalculateHashCode (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/Utility/ResourceManagerEventCollector.cs:62) UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.OnResourceManagerDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext eventContext) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/Utility/ResourceManagerEventCollector.cs:142) UnityEngine.ResourceManagement.ResourceManager.PostDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext context) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/ResourceManager.cs:367) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].DecrementReferenceCount () (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:217)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:592)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:532)
UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/ResourceManager/ResourceManager.cs:715)
UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/AddressablesImpl.cs:835)
UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.addressables@1.21.19/Runtime/Addressables.cs:1445)
UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Addressables/AddressablesInterface.cs:82)
UnityEngine.Localization.AddressablesInterface.SafeRelease (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Addressables/AddressablesInterface.cs:47)
UnityEngine.Localization.PropertyVariants.GameObjectLocalizer.OnDisable () (at ./Library/PackageCache/com.unity.localization@1.4.5/Runtime/Property Variants/GameObjectLocalizer.cs:78)
Are you able to file a bug report with the project or one that has the same issue so we can take a closer look?
I’ll try to isolate that asset and reproduce the issue in its own environment. If so, I’ll file the bug with it.
Thanks
aha,I met the same question.
I found that a gameobject with localize string event component will cause crash after I click the quit button.
And if I open the Development Build at Build Settings,there’s no crash,it’s weird.
Hi,
Could you please file a bug report for this? We don’t have any open bugs like this at the moment.
At first, in order to update the plug-in version, I upgraded Unity from 2021 to 2022, but it didn’t work and it still crashed.
Then I clean the addressables cache,rebuild the library folder,It’s fine if it’s weird.