-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple LocalizationSettings assets created if Library folder is deleted #20
Comments
Looks pretty simple to fix by inserting this check in SaveAsset method: var assetPath = "Assets/Resources/" + AssetName + ".asset";
if (!string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(assetPath)))
return;
// rest of the code But I'd still investigate why FindByResources() returns null |
Hi @iMobCoding , Thanks for addressing the issue. |
Yes but unfortunately that's a bad way to fix this. I have to find a reason why this is happening. I've discovered that in the empty project (with only localization installed) this doesn't happen. In my project few prefab variants are causing this (that's why it makes 18 settings files for me). I'll keep you posted and if I find it I'll make a PR |
Ok upon further investigation I found this Unity Issue: The problem is this according to their explanation: You won't experience this bug in normal circumstances. For me it happened with Odin and Localized Texts inside prefab variants. Every time Library got deleted, new LocalizedSettings were created as many times as there are Localized Texts in prefab variants... This PR fixes it |
@ibrahimpenekli Any news about the PR? |
Sorry I was busy I couldn't look into it. On a second thought, this solution will break backward compatibility. LocalizationSettings asset is not forced to be in a specific location. |
Hi @iMobCoding I used this Unity function to get active settings: GameToolkit-Localization/Packages/com.gametoolkit.localization/Runtime/LocalizationSettings.cs Line 134 in c0ce6d7
So, the settings asset does not need to be located in a specific folder or in the Resources folder. You can use this bugfix with the 2.2.3 version. |
Upon further testing of the v2.2.3 I found that it doesn't create new LocalizationSettings indeed, but it bombards the log with multiple worker warnings and errors. |
That is really strange behaviour. |
It's the 2021.3.24 Unity, but it happens with lower versions too. I think it doesn't happen with simple localizations but if used inside prefab or prefab variant then it happens. I'll prepare a small reproducible project and send it to you here |
Ok here is the reproducible project. Once you delete the Library and open the project, click once on Localization Settings and then on Panel - Variant prefab. You'll see the worker errors. You have to do it manually in this case as those prefabs aren't referenced in any scripts. In my project, several assets are referenced so when you delete the library folder everything happens automatically on project opening... Let me know if you can reproduce the issue Edit: you don't have to delete the whole Library folder every time, delete just the ArtifactDB file inside the Library folder and open the project again, it's faster for testing |
Thanks for the project and detailed explanation. I'll look into that as soon as possible when I have time. |
So try closing the Unity project. Then delete the Library folder and open the project again. Observe multiple LocalizationSettings assets created, in my case it's always original LocalizationSettings + 17 more.
Also there are some errors like:
[Worker0] CreateSerializedAsset is not supported while importing out-of-process
[Worker0] UnityException: Creating asset at path Assets/Resources/LocalizationSettings 18.asset failed.
This happens in Unity v2021.3.21
The problem is in line 66 of the LocalizationSettings.cs because Resources.Load returns null while importing assets. So then it goes to the CreateSettingsAndSave which saves new assets after delay multiple times...
The text was updated successfully, but these errors were encountered: