Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Strange bug with Serialized fields

Discussion in 'Scripting' started by Kev00, May 31, 2019.

  1. Kev00

    Kev00

    Joined:
    Dec 6, 2016
    Posts:
    167
    There is something strange going on with the editor. I'm not sure if it's something I'm doing incorrectly or if it's a bug with Unity.

    I'm using 2019.1.0f2

    I've extracted the issue to a more generic script.

    Here is my code.

    Code (CSharp):
    1. [Serializable]
    2.     public class TestAttributes
    3.     {
    4.  
    5.         public int TestAttribute1;
    6.         public int TestAttribute2;
    7.         public int TestAttribute3;
    8.         public int TestAttribute4;
    9.         public int TestAttribute5;
    10.         public int TestAttribute6;
    11.         public int TestAttribute7;
    12.         public int TestAttribute8;
    13.         public int TestAttribute9;
    14.         public int TestAttribute10;
    15.         public int TestAttribute11;
    16.         public int TestAttribute12;
    17.         public int TestAttribute13;
    18.         public int TestAttribute14;
    19.         public int TestAttribute15;
    20.         public int TestAttribute16;
    21.         public int TestAttribute17;
    22.         public int TestAttribute18;
    23.         public int TestAttribute19;
    24.         public int TestAttribute20;
    25.         public int TestAttribute21;
    26.         public int TestAttribute22;
    27.         public int TestAttribute23;
    28.         public int TestAttribute24;
    29.         public int TestAttribute25;
    30.         public int TestAttribute26;
    31.         public int TestAttribute27;
    32.         public int TestAttribute28;
    33.         public int TestAttribute29;
    34.         public int TestAttribute30;
    35.         public int TestAttribute31;
    36.         public int TestAttribute32;
    37.         public int TestAttribute33;
    38.         public int TestAttribute34;
    39.         public int TestAttribute35;
    40.         public int TestAttribute36;
    41.         public int TestAttribute37;
    42.         public int TestAttribute38;
    43.         public int TestAttribute39;
    44.         public int TestAttribute40;
    45.         public int TestAttribute41;
    46.         public int TestAttribute42;
    47.         public int TestAttribute43;
    48.         public int TestAttribute44;
    49.         public int TestAttribute45;
    50.         public int TestAttribute46;
    51.         public int TestAttribute47;
    52.         public int TestAttribute48;
    53.         public int TestAttribute49;
    54.         public int TestAttribute50;
    55.         public int TestAttribute51;
    56.         public int TestAttribute52;
    57.         public int TestAttribute53;
    58.         public int TestAttribute54;
    59.         public int TestAttribute55;
    60.         public int TestAttribute56;
    61.         public int TestAttribute57;
    62.         public int TestAttribute58;
    63.         public int TestAttribute59;
    64.         public int TestAttribute60;
    65.         public int TestAttribute61;
    66.         public int TestAttribute62;
    67.         public int TestAttribute63;
    68.         public int TestAttribute64;
    69.         public int TestAttribute65;
    70.         public int TestAttribute66;
    71.         public int TestAttribute67;
    72.         public int TestAttribute68;
    73.         public int TestAttribute69;
    74.         public int TestAttribute70;
    75.         public int TestAttribute71;
    76.         public int TestAttribute72;
    77.         public int TestAttribute73;
    78.         public int TestAttribute74;
    79.         public int TestAttribute75;
    80.         public int TestAttribute76;
    81.         public int TestAttribute77;
    82.         public int TestAttribute78;
    83.         public int TestAttribute79;
    84.         public int TestAttribute80;
    85.         public int TestAttribute81;
    86.         public int TestAttribute82;
    87.         public int TestAttribute83;
    88.         public int TestAttribute84;
    89.         public int TestAttribute85;
    90.         public int TestAttribute86;
    91.         public int TestAttribute87;
    92.         public int TestAttribute88;
    93.         public int TestAttribute89;
    94.         public int TestAttribute90;
    95.         public int TestAttribute91;
    96.         public int TestAttribute92;
    97.         public int TestAttribute93;
    98.         public int TestAttribute94;
    99.         public int TestAttribute95;
    100.         public int TestAttribute96;
    101.         public int TestAttribute97;
    102.         public int TestAttribute98;
    103.         public int TestAttribute99;
    104.         public int TestAttribute100;
    105.  
    106.  
    107.     }
    108.  
    109.    class TestDefinition : MonoBehaviour
    110.     {
    111.         [SerializeField]
    112.         public TestAttributes AttributeModifiers;
    113.     }
    114. }

    Now add the TestDefinition script to an object. I noticed that the inspector allows me to edit a cell below say item 30, but beyond that it doesn't allow me or it selects the wrong field. For example, clicking on the attribute field 40 will select attribute field 60. It seems to happen when the inspector is scrolled.

    Any ideas?
     
  2. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    21
    I see no issue here, trying on 2019.1.4f1 on an empty project.
    upload_2019-5-31_13-54-41.png
     
  3. Kev00

    Kev00

    Joined:
    Dec 6, 2016
    Posts:
    167
    thanks... I'll try to upgrade
     
  4. Kev00

    Kev00

    Joined:
    Dec 6, 2016
    Posts:
    167
    yeah, upgrading to 2019.1.4f1 fixed it!

    thanks
     
    brunocoimbra likes this.