Skip to content

Commit 612623a

Browse files
author
Rene Damm
authored
FIX: 'Should have drop target' asserts (case 1229146, #1107).
1 parent 05fd539 commit 612623a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ however, it has to be formatted properly to pass verification tests.
2828
- Actions and bindings in the `.inputactions` editor are no longer force-expanded on every domain reload and whenever a new action or binding is added.
2929
- The importer for `.inputactions` assets will now check out from version control the generated .cs file when overwriting it – which only happens if the contents differ ([case 1222972](https://issuetracker.unity3d.com/issues/inputsystem-editor-generated-c-number-file-is-not-checked-out-when-overwriting)).
3030
- The editor for `.inputactions` assets will now check out from version control the asset before saving it.
31+
- Drag-reordering action maps no longer throws "Should have drop target" asserts in the console (case [1229146](https://issuetracker.unity3d.com/issues/inputsystem-reordering-of-actionmaps-in-input-action-window-fails-and-throws-should-have-drop-target-error)).
3132

3233
### Changed
3334

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionTreeView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args)
471471
var assignNewIDs = !(isMove && sourceTree == this);
472472

473473
// Determine where we are moving/copying the data.
474-
var target = (args.parentItem ?? rootItem) as ActionTreeItemBase;
474+
var target = args.parentItem ?? rootItem;
475475
int? childIndex = null;
476476
if (args.dragAndDropPosition == DragAndDropPosition.BetweenItems)
477477
childIndex = args.insertAtIndex;
@@ -770,15 +770,15 @@ Type CopyTagToType(string tagName)
770770
{
771771
// Paste into InputActionAsset.
772772
array = serializedObject.FindProperty("m_ActionMaps");
773-
arrayIndex = array.arraySize;
773+
arrayIndex = location.childIndex ?? array.arraySize;
774774
}
775775
else
776776
{
777777
throw new InvalidOperationException($"Cannot paste {tag} into {location.item.displayName}");
778778
}
779779

780780
// If not given a specific index, we paste onto the end of the array.
781-
if (arrayIndex == -1)
781+
if (arrayIndex == -1 || arrayIndex > array.arraySize)
782782
arrayIndex = array.arraySize;
783783

784784
var actionForNewBindings = location.item is ActionTreeItem actionItem ? actionItem.name : null;

0 commit comments

Comments
 (0)