Search Unity

Bug Serializable class/struct array incorrectly displayed in inspector

Discussion in 'Editor & General Support' started by The-Real-Zap, May 24, 2022.

  1. The-Real-Zap

    The-Real-Zap

    Joined:
    Jan 23, 2015
    Posts:
    7
    When I have a MonoBehaviour that contains an array with a serializable struct or class having multiple public members, it is not displayed correctly in the inspector, more specifically the first element, when it's expanded. It still displays the remaining elements as if it is not expanded. I also noticed some slight space between the first and the remaining elements, if the first element is not expanded or the array contains non-expandable elements. Seems like some recent change, since I never noticed such an issue before. Attached is a screenshot.

    EDIT: Unity version is 2021.3.3f1

    Classes in the example contain following code:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class BugExample : MonoBehaviour
    4. {
    5.     public BugSerializableClass[] buggy;
    6. }
    Code (CSharp):
    1. [System.Serializable]
    2. public class BugSerializableClass
    3. {
    4.     public int val1;
    5.     public int val2;
    6.     public int val3;
    7. }
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class BugExample2 : MonoBehaviour
    4. {
    5.     public int[] ints;
    6. }
    7.  

    image_2022-05-24_215509253.png
     
    Last edited: May 26, 2022
    RoaringHeart likes this.
  2. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    50
  3. sue-shon

    sue-shon

    Joined:
    Sep 6, 2021
    Posts:
    2
    UP!
     
    The-Real-Zap likes this.
  4. Ditret

    Ditret

    Joined:
    Sep 1, 2013
    Posts:
    6
    same problem with this version of unity =/
     
    The-Real-Zap likes this.
  5. unity_F39951372D61BAAD10DB

    unity_F39951372D61BAAD10DB

    Joined:
    Sep 7, 2021
    Posts:
    1
    Yeap, problem in 2021.3.3f1 too.
     
    The-Real-Zap likes this.
  6. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,142
  7. Cornettu_

    Cornettu_

    Joined:
    Jun 12, 2021
    Posts:
    2
    Me too, in 2021.3.4f1
     
    RoaringHeart and The-Real-Zap like this.
  8. Ditret

    Ditret

    Joined:
    Sep 1, 2013
    Posts:
    6
    not fixed in 2021.3.4f1
     
    RoaringHeart likes this.
  9. Thimo_

    Thimo_

    Joined:
    Aug 26, 2019
    Posts:
    59
    I just tested with 2021.3.5f1 and this release fixed the List drawing problem.
     
    KyryloKuzyk likes this.