That did not help unfortunately, and the dialogue language did not change even after the advised resetting language player prefs in dialogue manager.
I am also using Lean Localization plugin to localize the UI, so I thought that maybe it is overwriting the "Language" key, but that is not the case, when I dug into the code, its saving under a different key, which is:
Code: Select all
PlayerPrefs.SetString("LeanLocalization.CurrentLanguage", currentLanguage);
So that is not the reason.
So, I decided to use a different key and manually call the PlayerPref.SetString() with this new key:
Code: Select all
if (language == "French")
{
DialogueManager.SetLanguage("fr");
PlayerPrefs.SetString("dialogue_language", "fr");
}
else if (language == "German")
{
DialogueManager.SetLanguage("de");
PlayerPrefs.SetString("dialogue_language", "de");
}
else if (language == "Portuguese")
{
DialogueManager.SetLanguage("pt");
PlayerPrefs.SetString("dialogue_language", "pt");
}
And then use this to load:
Code: Select all
DialogueManager.SetLanguage(PlayerPrefs.GetString("dialogue_language"));
With this change the dialogue text changes
Even now when I do
Code: Select all
Debug.LogWarning(PlayerPrefs.GetString("Language"));
it still returns empty, so for some reason the "Language" player pref is not saving or is being overwritten somewhere.