Localization revert to default fails

Announcements, support questions, and discussion for the Dialogue System.
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Localization revert to default fails

Post by Thistis »

Hello Tony,

I think we found the issue.
When we start a new game, we delete the PlayerPrefs for deleting the save game and I think this deletes the language preferences.
Currently this works for us:

Code: Select all

if (newGame) {
			string currentLanguage = Localization.Language;
			PlayerPrefs.DeleteAll();
			DialogueManager.SetLanguage(currentLanguage);
			SetInitialRandomValues();
		}

Is this sufficient or do we have to take care that we might have to restore something else by deleting the PlayerPrefs that the Dialogue Manager needs?

All the best,
Evelyn
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Localization revert to default fails

Post by Tony Li »

Hi Evelyn,

Generally that's fine, but I would recommend deleting only the "Language" key:

Code: Select all

PlayerPrefs.DeleteKey("Language");
If you want to change the name of this key, you can change it on the Dialogue Manager's UILocalizationManager component. If your Dialogue Manager doesn't have a UILocalizationManager, you can add one. Otherwise, at runtime the Dialogue Manager will automatically add a default one.

You might have other assets or scripts that use PlayerPrefs, so it's safer to delete only the one key. Deleting everything won't break the Dialogue System, but it may reset some player settings. The quest tracker HUD also saves the player's current visibility setting in PlayerPrefs. If you allow the player to toggle the quest tracker's visibility, it will store the current setting in PlayerPrefs. Also, if you use the Dialogue System's Menu Framework (available on the Dialogue System Extras page), it stores settings such as music volume and subtitles toggle in PlayerPrefs.
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Localization revert to default fails

Post by Thistis »

Thanks that solves our problem perfectly, thank you so much for you speedy reply and support have a nice day :)
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Localization revert to default fails

Post by Tony Li »

Happy to help! :-)
Post Reply