docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GenericListAdaptor<T>

    Reorderable list adaptor for generic list.

    Inheritance
    object
    GenericListAdaptor<T>
    Implements
    IReorderableListAdaptor
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.VisualScripting.ReorderableList
    Assembly: Unity.VisualScripting.Core.Editor.dll
    Syntax
    public class GenericListAdaptor<T> : IReorderableListAdaptor
    Type Parameters
    Name Description
    T

    Type of list element.

    Remarks

    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 which implement the ICloneable interface are cloned using that interface upon duplication; otherwise the item value or reference is simply copied.

    Constructors

    GenericListAdaptor(IList<T>, ItemDrawer<T>, float)

    Initializes a new instance of GenericListAdaptor<T>.

    Declaration
    public GenericListAdaptor(IList<T> list, ReorderableListControl.ItemDrawer<T> itemDrawer, float itemHeight)
    Parameters
    Type Name Description
    IList<T> list

    The list which can be reordered.

    ReorderableListControl.ItemDrawer<T> itemDrawer

    Callback to draw list item.

    float itemHeight

    Height of list item in pixels.

    Fields

    FixedItemHeight

    Fixed height of each list item.

    Declaration
    public float FixedItemHeight
    Field Value
    Type Description
    float

    Properties

    Count

    Gets count of elements in list.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    this[int]

    Gets element from list.

    Declaration
    public T this[int index] { get; }
    Parameters
    Type Name Description
    int index

    Zero-based index of element.

    Property Value
    Type Description
    T

    The element.

    List

    Gets the underlying list data structure.

    Declaration
    public IList<T> List { get; }
    Property Value
    Type Description
    IList<T>

    Methods

    Add()

    Add new element at end of list.

    Declaration
    public virtual void Add()

    BeginGUI()

    Occurs before any list items are drawn.

    Declaration
    public virtual void BeginGUI()
    Remarks

    This method is only used to handle GUI repaint events.

    See Also
    EndGUI()

    CanDrag(int)

    Determines whether an item can be reordered by dragging mouse.

    Declaration
    public virtual bool CanDrag(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index for list element.

    Returns
    Type Description
    bool

    A value of true if item can be dragged; otherwise false.

    Remarks

    This should be a light-weight method since it will be used to determine whether grab handle should be included for each item in a reorderable list.

    Please note that returning a value of false does not prevent movement on list item since other draggable items can be moved around it.

    CanRemove(int)

    Determines whether an item can be removed from list.

    Declaration
    public virtual bool CanRemove(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index for list element.

    Returns
    Type Description
    bool

    A value of true if item can be removed; otherwise false.

    Remarks

    This should be a light-weight method since it will be used to determine whether remove button should be included for each item in list.

    This is redundant when HideRemoveButtons is specified.

    Clear()

    Clear all elements from list.

    Declaration
    public virtual void Clear()

    DrawItem(Rect, int)

    Draws main interface for a list item.

    Declaration
    public virtual void DrawItem(Rect position, int index)
    Parameters
    Type Name Description
    Rect position

    Position in GUI.

    int index

    Zero-based index of array element.

    Remarks

    This method is used to handle all GUI events.

    DrawItemBackground(Rect, int)

    Draws background of a list item.

    Declaration
    public virtual void DrawItemBackground(Rect position, int index)
    Parameters
    Type Name Description
    Rect position

    Total position of list element in GUI.

    int index

    Zero-based index of array element.

    Remarks

    This method is only used to handle GUI repaint events.

    Background of list item spans a slightly larger area than the main interface that is drawn by DrawItem(Rect, int) since it is drawn behind the grab handle.

    Duplicate(int)

    Duplicate existing element.

    Declaration
    public virtual void Duplicate(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index of list element.

    Remarks

    Consider using the ICloneable interface to duplicate list elements where appropriate.

    EndGUI()

    Occurs after all list items have been drawn.

    Declaration
    public virtual void EndGUI()
    Remarks

    This method is only used to handle GUI repaint events.

    See Also
    BeginGUI()

    GetItemHeight(int)

    Gets height of list item in pixels.

    Declaration
    public virtual float GetItemHeight(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index of array element.

    Returns
    Type Description
    float

    Measurement in pixels.

    Insert(int)

    Insert new element at specified index.

    Declaration
    public virtual void Insert(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index for list element.

    Move(int, int)

    Move element from source index to destination index.

    Declaration
    public virtual void Move(int sourceIndex, int destIndex)
    Parameters
    Type Name Description
    int sourceIndex

    Zero-based index of source element.

    int destIndex

    Zero-based index of destination element.

    Remove(int)

    Remove element at specified index.

    Declaration
    public virtual void Remove(int index)
    Parameters
    Type Name Description
    int index

    Zero-based index of list element.

    Implements

    IReorderableListAdaptor

    Extension Methods

    Cloning.Clone(object, ICloner, bool)
    Cloning.Clone(object, ICloner, bool)
    Cloning.CloneViaFakeSerialization(object)
    Cloning.CloneViaFakeSerialization(object)
    ConversionUtility.ConvertTo(object, Type)
    ConversionUtility.ConvertTo(object, Type)
    ConversionUtility.ConvertTo<T>(object)
    ConversionUtility.ConvertTo<T>(object)
    ConversionUtility.IsConvertibleTo(object, Type, bool)
    ConversionUtility.IsConvertibleTo(object, Type, bool)
    ConversionUtility.IsConvertibleTo<T>(object, bool)
    ConversionUtility.IsConvertibleTo<T>(object, bool)
    Serialization.Serialize(object, bool)
    Serialization.Serialize(object, bool)
    TypeUtility.ToShortString(object, int)
    TypeUtility.ToShortString(object, int)
    UnityObjectUtility.IsUnityNull(object)
    UnityObjectUtility.IsUnityNull(object)
    UnityObjectUtility.ToSafeString(object)
    UnityObjectUtility.ToSafeString(object)
    XAnalyserProvider.Analyser(object, GraphReference)
    XAnalyserProvider.Analyser(object, IGraphContext)
    XAnalyserProvider.Analyser<TAnalyser>(object, GraphReference)
    XAnalyserProvider.Analyser<TAnalyser>(object, IGraphContext)
    XAnalyserProvider.Analysis(object, GraphReference)
    XAnalyserProvider.Analysis(object, IGraphContext)
    XAnalyserProvider.Analysis<TAnalysis>(object, GraphReference)
    XAnalyserProvider.Analysis<TAnalysis>(object, IGraphContext)
    XDescriptorProvider.Describe(object)
    XDescriptorProvider.Description(object)
    XDescriptorProvider.Description<TDescription>(object)
    XDescriptorProvider.Descriptor(object)
    XDescriptorProvider.Descriptor<TDescriptor>(object)
    XDescriptorProvider.HasDescriptor(object)
    Cloning.CloneViaFakeSerialization<T>(T)
    Cloning.CloneViaFakeSerialization<T>(T)
    Cloning.Clone<T>(T, ICloner, bool)
    Cloning.Clone<T>(T, ICloner, bool)
    LinqUtility.Yield<T>(T)
    LinqUtility.Yield<T>(T)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, bool)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, bool)
    Serialization.CloneViaSerialization<T>(T, bool)
    Serialization.CloneViaSerialization<T>(T, bool)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)