Tanoda
ReorderableListDebug.cs
Go to the documentation of this file.
1
3
5{
6 public class ReorderableListDebug : MonoBehaviour
7 {
8 public Text DebugLabel;
9
10 void Awake()
11 {
12 foreach (var list in FindObjectsOfType<ReorderableList>())
13 {
14 list.OnElementDropped.AddListener(ElementDropped);
15 }
16 }
17
18 private void ElementDropped(ReorderableList.ReorderableListEventStruct droppedStruct)
19 {
20 DebugLabel.text = "";
21 DebugLabel.text += "Dropped Object: " + droppedStruct.DroppedObject.name + "\n";
22 DebugLabel.text += "Is Clone ?: " + droppedStruct.IsAClone + "\n";
23 if (droppedStruct.IsAClone)
24 DebugLabel.text += "Source Object: " + droppedStruct.SourceObject.name + "\n";
25 DebugLabel.text += string.Format("From {0} at Index {1} \n", droppedStruct.FromList.name, droppedStruct.FromIndex);
26 DebugLabel.text += string.Format("To {0} at Index {1} \n", droppedStruct.ToList.name, droppedStruct.ToIndex);
27 }
28 }
29}
Credit Erdener Gonenc - @PixelEnvision.