Quantcast
Channel: Questions in topic: "localization"
Viewing all articles
Browse latest Browse all 210

Localization not working in builds

$
0
0
Hello, I am currently trying to add localization in my games to have 2 languages: english and french. I followed a tutorial, and it now works in editor mode: I can change language using a dropdown and everything is gravy. But when I build my game, nothing works, and I have error messages in Development build's console. Here are the errors when my project starts: ![alt text][1] And when I try to change language with my dropdown menu: ![alt text][2] I want to add that I only have 2 languages in my project and 2 options on my dropdown, and that my adressable assets are correctly located. Here is the code of my dropdown menu: using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.Localization.Settings; using UnityEngine.UI; public class ChangeLanguageMenu : MonoBehaviour { public TMP_Dropdown dropdown; public void Awake() { StartCoroutine(coroutineStart()); } public IEnumerator coroutineStart() { yield return LocalizationSettings.InitializationOperation; if (LocalizationSettings.SelectedLocale == null) { LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[0]; } dropdown.value = LocalizationSettings.SelectedLocale.SortOrder; } //Called by a dropdown menu when I change the selection, I only have 2 language in this dropdown public void setLanguage(int languageNumber) { StartCoroutine(coroutineSetLanguage(languageNumber)); } public IEnumerator coroutineSetLanguage(int languageNumber) { // Wait for the localization system to initialize, loading Locales, preloading, etc. yield return LocalizationSettings.InitializationOperation; LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[languageNumber]; } } Thanks you in advance for your help. [1]: /storage/temp/194959-screenshot-122.png [2]: /storage/temp/194960-screenshot-123.png

Viewing all articles
Browse latest Browse all 210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>