docs.unity.cn

Visual Scripting 1.9.0

    Show / Hide Table of Contents

    Class SerializedPropertyAdaptor

    Reorderable list adaptor for serialized array property.

    Inheritance
    Object
    SerializedPropertyAdaptor
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.VisualScripting.ReorderableList
    Syntax
    public class SerializedPropertyAdaptor : IReorderableListAdaptor
    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 are not cloned using the ICloneable interface when using a SerializedProperty to manipulate lists.

    Constructors

    SerializedPropertyAdaptor(SerializedProperty)

    Initializes a new instance of SerializedPropertyAdaptor.

    Declaration
    public SerializedPropertyAdaptor(SerializedProperty arrayProperty)
    Parameters
    Type Name Description
    SerializedProperty arrayProperty

    Serialized property for entire array.

    SerializedPropertyAdaptor(SerializedProperty, Single)

    Initializes a new instance of SerializedPropertyAdaptor.

    Declaration
    public SerializedPropertyAdaptor(SerializedProperty arrayProperty, float fixedItemHeight)
    Parameters
    Type Name Description
    SerializedProperty arrayProperty

    Serialized property for entire array.

    Single fixedItemHeight

    Non-zero height overrides property drawer height calculation.

    Fields

    FixedItemHeight

    Fixed height of each list item.

    Declaration
    public float FixedItemHeight
    Field Value
    Type Description
    Single
    Remarks

    Non-zero value overrides property drawer height calculation which is more efficient.

    Properties

    arrayProperty

    Gets the underlying serialized array property.

    Declaration
    public SerializedProperty arrayProperty { get; }
    Property Value
    Type Description
    SerializedProperty

    Count

    Gets count of elements in list.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32
    Implements
    IReorderableListAdaptor.Count

    Item[Int32]

    Gets element from list.

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

    Zero-based index of element.

    Property Value
    Type Description
    SerializedProperty

    Serialized property wrapper for array element.

    Methods

    Add()

    Add new element at end of list.

    Declaration
    public void Add()
    Implements
    IReorderableListAdaptor.Add()

    BeginGUI()

    Occurs before any list items are drawn.

    Declaration
    public virtual void BeginGUI()
    Implements
    IReorderableListAdaptor.BeginGUI()
    Remarks

    This method is only used to handle GUI repaint events.

    CanDrag(Int32)

    Determines whether an item can be reordered by dragging mouse.

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

    Zero-based index for list element.

    Returns
    Type Description
    Boolean

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

    Implements
    IReorderableListAdaptor.CanDrag(Int32)
    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(Int32)

    Determines whether an item can be removed from list.

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

    Zero-based index for list element.

    Returns
    Type Description
    Boolean

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

    Implements
    IReorderableListAdaptor.CanRemove(Int32)
    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 void Clear()
    Implements
    IReorderableListAdaptor.Clear()

    DrawItem(Rect, Int32)

    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.

    Int32 index

    Zero-based index of array element.

    Implements
    IReorderableListAdaptor.DrawItem(Rect, Int32)
    Remarks

    This method is used to handle all GUI events.

    DrawItemBackground(Rect, Int32)

    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.

    Int32 index

    Zero-based index of array element.

    Implements
    IReorderableListAdaptor.DrawItemBackground(Rect, Int32)
    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, Int32) since it is drawn behind the grab handle.

    Duplicate(Int32)

    Duplicate existing element.

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

    Zero-based index of list element.

    Implements
    IReorderableListAdaptor.Duplicate(Int32)
    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()
    Implements
    IReorderableListAdaptor.EndGUI()
    Remarks

    This method is only used to handle GUI repaint events.

    GetItemHeight(Int32)

    Gets height of list item in pixels.

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

    Zero-based index of array element.

    Returns
    Type Description
    Single

    Measurement in pixels.

    Implements
    IReorderableListAdaptor.GetItemHeight(Int32)

    Insert(Int32)

    Insert new element at specified index.

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

    Zero-based index for list element.

    Implements
    IReorderableListAdaptor.Insert(Int32)

    Move(Int32, Int32)

    Move element from source index to destination index.

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

    Zero-based index of source element.

    Int32 destIndex

    Zero-based index of destination element.

    Implements
    IReorderableListAdaptor.Move(Int32, Int32)

    Remove(Int32)

    Remove element at specified index.

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

    Zero-based index of list element.

    Implements
    IReorderableListAdaptor.Remove(Int32)

    Extension Methods

    XAnalyserProvider.Analyser(Object, IGraphContext)
    XAnalyserProvider.Analyser<TAnalyser>(Object, IGraphContext)
    XAnalyserProvider.Analysis(Object, IGraphContext)
    XAnalyserProvider.Analysis<TAnalysis>(Object, IGraphContext)
    XAnalyserProvider.Analyser(Object, GraphReference)
    XAnalyserProvider.Analyser<TAnalyser>(Object, GraphReference)
    XAnalyserProvider.Analysis(Object, GraphReference)
    XAnalyserProvider.Analysis<TAnalysis>(Object, GraphReference)
    XDescriptorProvider.Describe(Object)
    XDescriptorProvider.HasDescriptor(Object)
    XDescriptorProvider.Descriptor(Object)
    XDescriptorProvider.Descriptor<TDescriptor>(Object)
    XDescriptorProvider.Description(Object)
    XDescriptorProvider.Description<TDescription>(Object)
    Cloning.Clone(Object, ICloner, Boolean)
    Cloning.Clone<T>(T, ICloner, Boolean)
    Cloning.CloneViaFakeSerialization(Object)
    Cloning.CloneViaFakeSerialization<T>(T)
    ConversionUtility.IsConvertibleTo(Object, Type, Boolean)
    ConversionUtility.IsConvertibleTo<T>(Object, Boolean)
    ConversionUtility.ConvertTo(Object, Type)
    ConversionUtility.ConvertTo<T>(Object)
    TypeUtility.ToShortString(Object, Int32)
    Serialization.CloneViaSerialization<T>(T, Boolean)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, Boolean)
    Serialization.Serialize(Object, Boolean)
    LinqUtility.Yield<T>(T)
    UnityObjectUtility.IsUnityNull(Object)
    UnityObjectUtility.ToSafeString(Object)
    In This Article
    • Constructors
      • SerializedPropertyAdaptor(SerializedProperty)
      • SerializedPropertyAdaptor(SerializedProperty, Single)
    • Fields
      • FixedItemHeight
    • Properties
      • arrayProperty
      • Count
      • Item[Int32]
    • Methods
      • Add()
      • BeginGUI()
      • CanDrag(Int32)
      • CanRemove(Int32)
      • Clear()
      • DrawItem(Rect, Int32)
      • DrawItemBackground(Rect, Int32)
      • Duplicate(Int32)
      • EndGUI()
      • GetItemHeight(Int32)
      • Insert(Int32)
      • Move(Int32, Int32)
      • Remove(Int32)
    • Extension Methods
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Friday, August 4, 2023