public static void DuplicateArrayElement(object userData) { RuntimeSerializedProperty runtimeSerializedProperty = userData as RuntimeSerializedProperty; runtimeSerializedProperty.DuplicateCommand(); EditorUtilityHelper.ForceReloadInspectors(); }
private static void DoPropertyFieldKeyboardHandling(RuntimeSerializedProperty property) { // Delete & Duplicate commands if (Event.current.type == EventType.ExecuteCommand || Event.current.type == EventType.ValidateCommand) { if (GUIUtility.keyboardControl == EditorGUIUtilityHelper.s_LastControlID && (Event.current.commandName == EventCommandNamesHelper.Delete || Event.current.commandName == EventCommandNamesHelper.SoftDelete)) { if (Event.current.type == EventType.ExecuteCommand) { // Wait with deleting the property until the property stack is empty. See EndProperty. s_PendingPropertyDelete = property.Copy(); } Event.current.Use(); } if (GUIUtility.keyboardControl == EditorGUIUtilityHelper.s_LastControlID && Event.current.commandName == EventCommandNamesHelper.Duplicate) { if (Event.current.type == EventType.ExecuteCommand) { property.DuplicateCommand(); } Event.current.Use(); } } s_PendingPropertyKeyboardHandling = null; }