Reorderable list adaptor for serialized array property.

This adaptor can be subclassed to add special logic to item height calculation. You may want to implement a custom adaptor class where specialised functionality is needed.

List elements are not cloned using the System.ICloneable interface when using a UnityEditor.SerializedProperty to manipulate lists.

Inheritance: IReorderableListAdaptor
コード例 #1
0
        /// <summary>
        /// Draw list field control for serializable property array.
        /// </summary>
        /// <param name="position">Position of control.</param>
        /// <param name="arrayProperty">Serializable property.</param>
        /// <param name="fixedItemHeight">Use fixed height for items rather than <see cref="UnityEditor.EditorGUI.GetPropertyHeight(SerializedProperty)"/>.</param>
        /// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
        /// <param name="flags">Optional flags to pass into list field.</param>
        private static void DoListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags)
        {
            var adaptor = new SerializedPropertyAdaptor(arrayProperty, fixedItemHeight);

            ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags);
        }
コード例 #2
0
        /// <summary>
        /// Draw list field control for serializable property array.
        /// </summary>
        /// <param name="arrayProperty">Serializable property.</param>
        /// <param name="fixedItemHeight">Use fixed height for items rather than <see cref="UnityEditor.EditorGUI.GetPropertyHeight(SerializedProperty)"/>.</param>
        /// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
        /// <param name="flags">Optional flags to pass into list field.</param>
        private static void DoListField(SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags)
        {
            SerializedPropertyAdaptor adaptor = new SerializedPropertyAdaptor(arrayProperty, fixedItemHeight);

            ReorderableListControl.DrawControlFromState(adaptor, drawEmpty, flags);
        }