Class MetadataCollectionAdaptor
Implements
Inherited Members
Namespace: Unity.VisualScripting
Assembly: Unity.VisualScripting.Core.Editor.dll
Syntax
public abstract class MetadataCollectionAdaptor : IReorderableListAdaptor
Constructors
MetadataCollectionAdaptor(Metadata, Inspector)
Declaration
protected MetadataCollectionAdaptor(Metadata metadata, Inspector parentInspector)
Parameters
Properties
Count
Gets count of elements in list.
Declaration
public abstract int Count { get; }
Property Value
Type | Description |
---|---|
int |
parentInspector
Declaration
protected Inspector parentInspector { get; }
Property Value
Type | Description |
---|---|
Inspector |
Methods
Add()
Add new element at end of list.
Declaration
public abstract 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.
CanDrag(int)
Determines whether an item can be reordered by dragging mouse.
Declaration
public abstract bool CanDrag(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
bool | A value of |
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 abstract bool CanRemove(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
bool | A value of |
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 Hide
Clear()
Clear all elements from list.
Declaration
public abstract void Clear()
DrawItem(Rect, int)
Draws main interface for a list item.
Declaration
public abstract void DrawItem(Rect position, int index)
Parameters
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 Draw
Duplicate(int)
Duplicate existing element.
Declaration
public abstract 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.
Field(Rect, GUIContent)
Declaration
public bool Field(Rect position, GUIContent label)
Parameters
Type | Name | Description |
---|---|---|
Rect | position | |
GUIContent | label |
Returns
Type | Description |
---|---|
bool |
GetAdaptiveWidth()
Declaration
public float GetAdaptiveWidth()
Returns
Type | Description |
---|---|
float |
GetHeight(float, GUIContent)
Declaration
public float GetHeight(float width, GUIContent label)
Parameters
Type | Name | Description |
---|---|---|
float | width | |
GUIContent | label |
Returns
Type | Description |
---|---|
float |
GetItemAdaptiveWidth(int)
Declaration
public abstract float GetItemAdaptiveWidth(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
float |
GetItemHeight(int)
Gets height of list item in pixels.
Declaration
public float GetItemHeight(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index of array element. |
Returns
Type | Description |
---|---|
float | Measurement in pixels. |
GetItemHeight(float, int)
Declaration
public abstract float GetItemHeight(float width, int index)
Parameters
Returns
Type | Description |
---|---|
float |
GetTitleHeight(float, GUIContent)
Declaration
protected virtual float GetTitleHeight(float width, GUIContent title)
Parameters
Type | Name | Description |
---|---|---|
float | width | |
GUIContent | title |
Returns
Type | Description |
---|---|
float |
Insert(int)
Insert new element at specified index.
Declaration
public abstract 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 abstract 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. |
OnTitleGUI(Rect, GUIContent)
Declaration
protected virtual void OnTitleGUI(Rect position, GUIContent title)
Parameters
Type | Name | Description |
---|---|---|
Rect | position | |
GUIContent | title |
Remove(int)
Remove element at specified index.
Declaration
public abstract void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index of list element. |