NonReorderableAttribute
Disables reordering of an array or list in the Inspector window.
Read time 3 minutesLast updated 4 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Inherits from: PropertyAttribute
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]public sealed class NonReorderableAttribute : PropertyAttribute
Remarks
By default, array or list script variables are presented with a UI control that allows array element reordering via drag handles to the left of element content. You can use [NonReorderable] attribute on a script array or list variable to disable this. When reordering is disabled, the Inspector shows arrays or lists with a simple UI control that has an array size followed by array elements.
Examples
using UnityEngine;public class NonReorderableAttributeTest : MonoBehaviour{ [NonReorderable] public int[] array;}