Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Serialized private arrays not using reorderable array

Discussion in 'Editor & General Support' started by Crafted_King, Jan 30, 2021.

  1. Crafted_King

    Crafted_King

    Joined:
    Feb 6, 2019
    Posts:
    3
    I was using the messing around with the new reorderable arrays in the 2020.2 and found that if you have a script that inherits from another script, and you serialize a private array, the serialized private array does not use the new reorderable editor component, instead it uses the old unorderable array.

    Code I used is as follows:
    Code (CSharp):
    1. public class TestScript : blah {}
    2.    
    3. public class blah : MonoBehaviour {
    4.         public Test[] aArray;
    5.         [SerializeField] private Test[] bArray;
    6. }
    7.  
    8. [System.Serializable]
    9. public class Test {
    10.         public GameObject a;
    11.         public int b;
    12.         public float c;
    13. }
    Editor:
    ArrayEditor.PNG