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 Reordering a list of items containing a LocalizedString swaps everything except the LocalizedString

Discussion in 'Localization Tools' started by b4gn0, Oct 19, 2020.

  1. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    We suffered from this bug today, and seems to happen only with LocalizedStrings.

    Create a simple serializable class:

    Code (CSharp):
    1.     [System.Serializable]
    2.     public class MyLocalizedClass
    3.     {
    4.         public int Id;
    5.         public LocalizedString Text;
    6.     }
    Add in any monobehaviour a field of type List<MyLocalizedClass>.

    In editor, add two items in the list, one with Id 0 and a LocalizedString (let's say "A"), and the other with Id 1 and another LocalizedString (let's say "B").

    Current list:
    0, "A"
    1, "B"

    Reorder it in the editor.

    Expected result:
    1, "B"
    0, "A"

    Current result:
    1, "A"
    0, "B"

    All the fields of the serializable class changed, except the LocalizedString ones.

    Editor version: 2020.2.0b1

    Thank you
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,423
  3. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    Done, case number 1286120.

    I'm curious to know if it's something related to the editor or the localization package :)

    Thank you, meanwhile!
     
    Last edited by a moderator: Oct 19, 2020
    karl_jones likes this.
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,423
    I suspect its the package. We do some caching in our property drawers so its probably just that.
     
    b4gn0 likes this.
  5. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    Oh, shoot, you are right!
    Deselecting and reselecting the container again actually shows the correct values.

    This makes it at least somewhat usable, I had switched to manually editing scriptable objects.

    Thank you
     
    karl_jones likes this.