Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cfoulston/Unity-Reorderable-List
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Foulston committed Jul 11, 2017
2 parents f2931ba + 15e67cf commit a407ff3
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Assets/ReorderableList/List/Editor/ReorderableList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1872,26 +1872,42 @@ static class Internals {
static Internals() {

dragDropValidation = System.Type.GetType("UnityEditor.EditorGUI, UnityEditor").GetMethod("ValidateObjectFieldAssignment", BindingFlags.NonPublic | BindingFlags.Static);
dragDropValidationParams = new object[3];

appendDragDrop = typeof(SerializedProperty).GetMethod("AppendFoldoutPPtrValue", BindingFlags.NonPublic | BindingFlags.Instance);
appendDragDropParams = new object[1];
}

internal static Object ValidateObjectDragAndDrop(Object[] references, SerializedProperty property) {

#if UNITY_2017_1_OR_NEWER
dragDropValidationParams = GetParams(ref dragDropValidationParams, 4);
dragDropValidationParams[0] = references;
dragDropValidationParams[1] = null;
dragDropValidationParams[2] = property;

dragDropValidationParams[3] = 0;
#else
dragDropValidationParams = GetParams(ref dragDropValidationParams, 3);
dragDropValidationParams[0] = references;
dragDropValidationParams[1] = null;
dragDropValidationParams[2] = property;
#endif
return dragDropValidation.Invoke(null, dragDropValidationParams) as Object;
}

internal static void AppendDragAndDropValue(Object obj, SerializedProperty list) {

appendDragDropParams = GetParams(ref appendDragDropParams, 1);
appendDragDropParams[0] = obj;
appendDragDrop.Invoke(list, appendDragDropParams);
}

private static object[] GetParams(ref object[] parameters, int count) {

if (parameters == null) {

parameters = new object[count];
}

return parameters;
}
}
}
}
Expand Down

0 comments on commit a407ff3

Please sign in to comment.