Skip to content

Commit 29001d0

Browse files
Fix asynchronous loading of locales on WebGL platform
1 parent 87583ce commit 29001d0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Assets/Project/Scripts/Game Objects/UI/Panel/LanguageButtonsPanelUI.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@
55
public class LanguageButtonsPanelUI : PanelUI
66
{
77
[SerializeField] private LanguageButtonUI languageButtonUI;
8-
8+
9+
#if !UNITY_WEBGL
910
private void Awake()
11+
{
12+
CreateLanguageButtons();
13+
}
14+
#else
15+
private async void Start()
16+
{
17+
await LocalizationSettings.InitializationOperation.Task;
18+
19+
CreateLanguageButtons();
20+
}
21+
#endif
22+
23+
private void CreateLanguageButtons()
1024
{
1125
LocalizationSettings.AvailableLocales.Locales.GetReversedList().ForEach(CreateLanguageButtonWithLocale);
1226
}

0 commit comments

Comments
 (0)