Skip to main content

All Arrays And Lists Are Now Reorderables by Default

What are reorderables?

As soon as you open up Unity 2022.3, you may start to notice that all arrays and lists look a little different from how they used to in 2019.4.

image.png

This is because by default, all arrays and lists are now "reorderables", meaning that you can reorder items by dragging them. Many advanced creators have already been using reorderable lists before by accessing the Unity's internal APIs, but now they are available by default to everyone with zero code.

Can I revert the arrays to how they used to be?

Absolutely! In order to disable reorderable arrays or lists, all you have to do is add the NonReorderableAttribute above your array:

[NonReorderable]
[SerializeField, FieldNullWarning(true)]
private Image[] panelColorExampleImages;

[NonReorderable]
[SerializeField, FieldNullWarning(true)]
private TextMeshProUGUI[] contentColorExampleTexts;

[NonReorderable]
[SerializeField, FieldNullWarning(true)]
internal GameObject[] examplesToDestroyOnBuild;

By using the attribute, all of your arrays should be back to how they used to be in 2019.4:

image.png

PUBLIC ASSET AUTHORS - PLEASE NOTE!

Migration to Unity 2022.3 may take even up to a year or more, so if you are a developer of publicly distributed assets, please note that NonReorderableAttribute is not available in Unity 2019.4!

For publicly distributed scripts you can use the following define for ensuring that the end users are not running into compiler errors when attempting to import your scripts into their projects still using Unity 2019.4:

#if UNITY_2020_2_OR_NEWER
        [NonReorderable]
#endif
        [SerializeField]
        private GameObject[] myArray;