private void HandlePasteEvent() { var copyBufferString = EditorGUIUtility.systemCopyBuffer; var elements = copyBufferString.Split(new[] { k_InputAssetMarker }, StringSplitOptions.RemoveEmptyEntries); if (!copyBufferString.StartsWith(k_InputAssetMarker)) { return; } SerializedProperty currentActionMapProperty = null; var selectedActionMap = m_TreeView.GetSelectedActionMap(); if (selectedActionMap != null) { currentActionMapProperty = selectedActionMap.elementProperty; } for (var i = 0; i < elements.Length; i++) { var row = elements[i]; if (IsRowOfType <ActionMapTreeItem>(ref row)) { if (m_SerializedObject == null) { throw new InvalidOperationException("Pasting action map is not a valid operation"); } currentActionMapProperty = InputActionSerializationHelpers.AddActionMapFromSavedProperties(m_SerializedObject, GetParameterDictionary(row)); m_Apply(); continue; } if (IsRowOfType <ActionTreeItem>(ref row)) { var newActionProperty = InputActionSerializationHelpers.AddActionFromSavedProperties(GetParameterDictionary(row), currentActionMapProperty); while (i + 1 < elements.Length) { try { var nextRow = elements[i + 1]; if (nextRow.StartsWith(typeof(BindingTreeItem).Name)) { nextRow = nextRow.Substring(typeof(BindingTreeItem).Name.Length); } else if (nextRow.StartsWith(typeof(CompositeGroupTreeItem).Name)) { nextRow = nextRow.Substring(typeof(CompositeGroupTreeItem).Name.Length); } else if (nextRow.StartsWith(typeof(CompositeTreeItem).Name)) { nextRow = nextRow.Substring(typeof(CompositeTreeItem).Name.Length); } else { break; } InputActionSerializationHelpers.AddBindingFromSavedProperties(GetParameterDictionary(nextRow), newActionProperty, currentActionMapProperty); i++; } catch (ArgumentException e) { Debug.LogException(e); break; } } m_Apply(); continue; } if (IsRowOfType <BindingTreeItem>(ref row) || IsRowOfType <CompositeGroupTreeItem>(ref row) || IsRowOfType <CompositeTreeItem>(ref row)) { var selectedRow = m_TreeView.GetSelectedAction(); if (selectedRow == null) { EditorApplication.Beep(); continue; } selectedRow.AddBindingFromSavedProperties(GetParameterDictionary(row)); m_Apply(); continue; } } }