Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

AssertionException: Assertion failure. Value was Null

Discussion in 'Localization Tools' started by santi2493, Dec 22, 2021.

  1. santi2493

    santi2493

    Joined:
    Jan 22, 2014
    Posts:
    8
    Hi I'm having some issues with localization and the assets table.
    All assets flags are preload and I build the addressable groups, but when I use android the assets aren't load the first time until its selected one time.
    And when I run the editor with addressable groups> play mode> Use Existing Build
    it throws "AssertionException: Assertion failure. Value was Null" when I try to change the language, it doesn't stop the game but it happen the same as in android the assets aren't load until I go back and forward selecting.


    public void ChangeLaguage(int i)
    {
    int selected = 0;
    for (int j = 0; j < LocalizationSettings.AvailableLocales.Locales.Count; ++j)
    {
    var locale = LocalizationSettings.AvailableLocales.Locales[j];
    if (LocalizationSettings.SelectedLocale == locale)
    selected = j;
    }
    selected += i;

    if(selected>=LocalizationSettings.AvailableLocales.Locales.Count)
    {
    selected = 0;
    }
    if (selected < 0)
    {
    selected = LocalizationSettings.AvailableLocales.Locales.Count-1;
    }

    LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[selected];
    PlayerPrefs.SetInt("selected-locale", selected);
    }

    This is the method I'm using to change the language if it helps.
    I have try different ways to fix but nothing seems to work
    I'm using unity 2020.3.23, Localization 1.0.5, Addressable 1.19.11

    bscap0000.jpg bscap0001.jpg bscap0004.jpg
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,851
  3. santi2493

    santi2493

    Joined:
    Jan 22, 2014
    Posts:
    8
    I tried

    IEnumerator Start()
    {
    yield return LocalizationSettings.InitializationOperation;

    Debug.Log("Initialization Completed");
    }

    At the beginning of the game. I don't know if its the correct way of doing it. But the error keep showing.

    I could try in a clean project, I have delete the library and open again but didn't work neither

    Does my sprites need to be in a Resource folder or marked in some way?
     
    Last edited: Dec 22, 2021
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,851
    Try checking the initialization operation isDone inside of ChangeLaguage. Is it true?
     
  5. santi2493

    santi2493

    Joined:
    Jan 22, 2014
    Posts:
    8
    Hi sorry for the late response.
    I tried

    if (!LocalizationSettings.InitializationOperation.IsDone)
    {
    Debug.Log("NotDone");
    return;
    }
    else
    {
    Debug.Log("Done");
    }

    when the menu is open and and in ChangeLaguage() and both shows as Done
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,851
    Hmm. The original error message does look familiar. We fixed a bug for this recently. 1.1 should be out in a couple of weeks, can you try that and let me know if it still doesn't work?
     
  7. santi2493

    santi2493

    Joined:
    Jan 22, 2014
    Posts:
    8
    Sure! I'll check it when the new update rolls out
     
    karl_jones likes this.
  8. santi2493

    santi2493

    Joined:
    Jan 22, 2014
    Posts:
    8
    I tested the new release. Its working perfectly in all devices now and the error disappeared. Thanks for all the help
     
    karl_jones likes this.