Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anchan828/unity-reorderablelist
https://github.com/anchan828/unity-reorderablelist
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/anchan828/unity-reorderablelist
- Owner: anchan828
- Created: 2013-10-20T16:31:43.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-05T16:07:02.000Z (about 10 years ago)
- Last Synced: 2023-03-15T19:10:42.763Z (almost 2 years ago)
- Language: C#
- Homepage: http://anchan828.hatenablog.jp/entry/2013/10/12/033347
- Size: 145 KB
- Stars: 13
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
unity-ReorderableList
=====================![](http://gyazo.com/9e65eda84242ee5d6e3ecf7d77d163d4.png)
```
using UnityEngine;public class Sample : MonoBehaviour
{
public string[] texts = new string[2];
}
``````
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Sample))]
public class SampleInspector : Editor
{
private ReorderableList list = null;
public override void OnInspectorGUI()
{
if (list == null)
{
list = new ReorderableList(serializedObject, serializedObject.FindProperty("texts"));
}
else
{
list.DoList();
}
}
}
```## API
### Constructor
Name|Description
:---|:---
ReorderableList|```
public ReorderableList(SerializedObject serializedObject, SerializedProperty serializedProperty, bool draggable = true, bool displayHeader = true, bool displayAddButton = true, bool displayRemoveButton = true)
```Type|Name|Description
:---|:---|:---
SerializedObject|serializedObject|
SerializedProperty|serializedProperty|
bool|draggable| Can elements drag?
bool|displayHeader| Draw header , if true. The default is true.
bool|displayAddButton| Draw AddButton , if true. The default is true.
bool|displayRemoveButton| Draw RemoveButton , if true. The default is true.### Variables
Type|Name|Description
:---|:---|:---
SerializedObject|serializedObject|
SerializedProperty|serializedProperty|
float|elementHeight| The default is 21.
DrawElementCallback|drawElementCallback|
DrawHeaderCallback|drawHeaderCallback|
AddCallbackDelegate|onAddDelegateCallback|
RemoveCallbackDelegate|onRemoveDelegateCallback|
SelectCallbackDelegate|onSelectCallback|### Functions
Name|Description
:---|:---
DoList| Draw ReorderableList### Delegates
Name|Description
:---|:---
DrawElementCallback|
DrawHeaderCallback|
SelectCallbackDelegate|
AddCallbackDelegate|
RemoveCallbackDelegate|```
public delegate void DrawElementCallback(Rect rect, int index, bool selected, bool focused);public delegate void DrawHeaderCallback(Rect rect);
public delegate void SelectCallbackDelegate(int index);
public delegate void AddCallbackDelegate();
public delegate void RemoveCallbackDelegate();
```