Skip to content

Commit b7f93d8

Browse files
committed
[Input System] Fixed pasting bindings into empty Input Action asset (case ISXB-1180) - take #2
FIX: Fixed pasting bindings into empty Input Action asset (case ISXB-1180) Ensure PasteBlocks() deals with invalid selection - when copied type is binding we need to have a valid Action selected to paste into.
1 parent b0478f0 commit b7f93d8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,18 @@ private static void PasteBlocks(string transmission, int indexToInsert, Serializ
265265
else
266266
{
267267
var actionName = Selectors.GetSelectedBinding(s_State)?.wrappedProperty.FindPropertyRelative("m_Action")
268-
.stringValue;
268+
.stringValue;
269+
269270
if (s_State.selectionType == SelectionType.Action)
270-
actionName = PropertyName(Selectors.GetSelectedAction(s_State)?.wrappedProperty);
271+
{
272+
SerializedProperty property = Selectors.GetSelectedAction(s_State)?.wrappedProperty;
273+
if (property == null)
274+
return;
275+
actionName = PropertyName(property);
276+
}
277+
if (actionName == null)
278+
return;
279+
271280
PasteBindingOrComposite(arrayToInsertInto, block, indexToInsert, actionName);
272281
}
273282
}

0 commit comments

Comments
 (0)