Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Custom locale selectors are Empty on project reload

Discussion in 'Localization Tools' started by fogcloud, Sep 30, 2020.

  1. fogcloud

    fogcloud

    Joined:
    Mar 1, 2019
    Posts:
    2
    Pretty much the thread title - I have two Locale Selectors I'd like to have run before the default ones, the RegionLocaleSelector and the StageLocaleSelector. I can add them to the list as follows:

    upload_2020-9-30_15-34-8.png

    When I add them both to the list and move them to the top, I get the following errors in the console:

    upload_2020-9-30_15-34-45.png

    However, it appears to work, because when I run our project in the editor, I am able to see print statements from those locale selectors, and they select the locale properly:

    upload_2020-9-30_15-37-2.png

    As well, once I close Unity, the LocalizationSettings file appears to have saved correctly, since my new LocaleSelectors appear in the Git diff of the file:

    upload_2020-9-30_15-38-36.png

    However, once I load the project up again, I see this in the Locale Selectors, and I get NullReferenceExceptions trying to run the project through the editor.

    upload_2020-9-30_15-39-45.png

    Am I missing something here, or is this a bug?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,418
    What version of Unity are you using? This was a bug with SerialiseReference but it should be fixed. Can you try updating to the latest patch/version?

    The bug was caused by having a Serialised class that contained no serializable fields. So if you want to just work around it then add a placeholder field that can be serialized.

    E.g

    Code (csharp):
    1. [SerializeField, HideInInspector]
    2. Int myPlaceholderValue.
     
    Last edited: Oct 1, 2020
  3. fogcloud

    fogcloud

    Joined:
    Mar 1, 2019
    Posts:
    2
    We are on 2019.3.3f1 with localization at 8.1 and addressables at 1.15.1. This workaround fixed for us - thank you!
     
    karl_jones likes this.