Skip to content

Commit

Permalink
fix: en_us locale causes leakage of ScriptableObject
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuryg committed May 22, 2024
1 parent 62c9eed commit 21bcc4f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class LocalizationSetting : IReadOnlyLocalizationSetting, ILocalizationSe

private Subject<LocalizationTable> _onTableChanged = new Subject<LocalizationTable>();

private static LocalizationTable en_us;

public LocalizationSetting()
{
var locale = GetLocale();
Expand Down Expand Up @@ -87,7 +89,9 @@ public static LocalizationTable GetTable(Locale locale)
else
{
// en_US has the table in source code, not asset.
return ScriptableObject.CreateInstance<LocalizationTable>();
en_us = en_us != null ? en_us : ScriptableObject.CreateInstance<LocalizationTable>();

return en_us;
}
}

Expand Down

0 comments on commit 21bcc4f

Please sign in to comment.