(Case 1358410) Unity sometimes creates new AssetGroups for Localization-String-Tables automatically

We have the problem that opening our project sometimes causes the Unity editor to modify existing Localization-String-Tables* AssetGroup’s and to create a whole bunch of new ones.

The “fix” is always to close Unity, discard/delete those magic-files and open Unity again. This always fixes the problem for a while. I believe it most often occurs when someone pulls new content from git.

Is there some code that runs on editor-startup that would do this? Perhaps it’s because the string tables don’t use the default name?

Hmm. Yes we do some stuff when importing assets. We have a system to control what addressables group an asset goes into.
Have you configured an addressables group rules asset? Addressables Integration | Localization | 1.0.5
The idea is to allow you to configure what groups we use whenever we need to update addressables.

If we are creating empty groups then that may be worth a bug report.

I think if you untick the move entries in unknown groups then it may solve the issue.

Is this callstack somewhat useful? When opening the project, this error occurs randomly:

Cannot add null IGroupTemplate
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogWarning(Object)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:AddGroupTemplateObject(IGroupTemplate, Boolean) (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/Settings/AddressableAssetSettings.cs:693)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:LoadGroupTemplateObject(AddressableAssetSettings, String) (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/Settings/AddressableAssetSettings.cs:1431)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:CreateDefaultGroupTemplate(AddressableAssetSettings) (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/Settings/AddressableAssetSettings.cs:1424)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:Validate() (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/Settings/AddressableAssetSettings.cs:1179)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:Create(String, String, Boolean, Boolean) (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/Settings/AddressableAssetSettings.cs:1249)
UnityEditor.AddressableAssets.AddressableAssetSettingsDefaultObject:GetSettings(Boolean) (at Library/PackageCache/com.unity.addressables@1.18.4/Editor/AddressableAssetSettingsDefaultObject.cs:170)
UnityEditor.Localization.LocalizationEditorSettings:GetAddressableAssetSettings(Boolean) (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Settings/LocalizationEditorSettings.cs:388)
UnityEditor.Localization.LocalizationTableCollection:AddSharedTableDataToAddressables() (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Settings/LocalizationTableCollection.cs:477)
UnityEditor.Localization.LocalizationTableCollection:RefreshAddressables(Boolean) (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Settings/LocalizationTableCollection.cs:319)
UnityEditor.Localization.LocalizationTableCollection:ImportCollectionIntoProject() (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Settings/LocalizationTableCollection.cs:540)
UnityEditor.Localization.LocalizationAssetPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Editor/Asset Pipeline/LocalizationAssetPostProcessor.cs:31)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
UnityEditor.AssetPostprocessingInternal:InvokeMethod(MethodInfo, Object[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:744)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[]) (at /Users/bokken/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:165)

It don’t know if it’s related to the “creates string tables automagically” though.

That is when we are doing the import of a collection. The error seems to be coming from us calling to get the Addressable asset settings - GetAddressableAssetSettings
This is attempting to load an asset

string assetPath = aa.GroupTemplateFolder + "/" + aa.m_DefaultGroupTemplateName + ".asset";

I think the default path would be Assets/AddressableAssets/AssetGroupTemplates/Packed Assets.asset
Does that file exist?

1 Like

Yes, it exists at that location.

Maybe Addressables hasn’t been initialized when Localization tries to access it? In this particular case, it was a fresh git-clone and first open of the project.

Ah yes that could be it. Its worth a bug report if you manage to find a way to reproduce it :slight_smile:

I don’t seem to be able to find a reliable reproduce outside our production project. Any chance you can look into it without a reproduction project?

An useful attempt to fix it might be to defer what the Localization package is doing during the PostprocessAllAssets step to ensure it runs after Addressables.

This is already during PostprocessAllAssets :wink:
There should be enough here to look into it. Ill create a bug

1 Like

That’s very helpful, thank you!

I really hope initialization order is the issue, because it causes so much issues for us in the team. Would be like a dream come true if it can be sorted out. :slight_smile:

1 Like

Do you happen to know when a fix for this issue is released?

We don’t have a fix for it at the moment. Its unlikely to be in the next release as that one is almost ready. I’ll try and look into it once we get the next release out.

1 Like

Thank you!

Hello :slight_smile: Do you have any progress on this issue?

I’ve to battle with it almost daily. For example, I just had to remove those automagically created files from version control, because someone committed them by accident.

Do you have some steps that reproduce the issue. I have not had a chance to look into this one yet but any extra information you can provide will help.

Unfortunately I don’t, because it occurs randomly. I believe the project requires a certain complexity in sense of number of assets and Addressables asset-groups in the project.

The issue most often triggers when I clone our git repository and open the fresh copy. But it also triggers when pulling new content in an existing repo, but it does not trigger that often in this case.

I can see that Addressables also has an AssetPostprocessor step so I suspect that its just the order that they are executed. Can you test a change to see if it fixes the issue for you?

7414469–906905–patch.patch.txt (894 Bytes)

1 Like

Quick question :slight_smile:

The file I have to change is located in Library\PackageCache\com.unity.localization@1.0.0-pre.10\Editor\Asset Pipeline\LocalizationAssetPostProcessor.cs, but my test would have been to delete the Library directory and let the editor reimport everything. But this file is stored in the Library directory too.

How can I actually test it?

Ah good point :slight_smile:
Can you copy the com.unity.localization directory into your Projects directory? It will let you then make changes to it without them being reverted

1 Like

I was able to strip all but the Addressables and Localization assets from our project and the issue still reproduces.

Took me almost a day of work, but here is a project where the issue reproduces in a very reliable way:

(Case 1358410) 2019.4: Unity sometimes creates new AssetGroups for Localization-String-Tables automatically

Please make sure to watch the video that’s attached to the bug-report to understand when the issue reproduces and when it doesn’t reproduce.

Looking forward to your findings!

1 Like

Thanks really appreciate the effort you took :slight_smile:

1 Like