Skip to content

Commit 392b370

Browse files
author
Rene Damm
authored
FIX: Properties of actions embedded into components not being editable (#766).
1 parent cc23cfe commit 392b370

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ however, it has to be formatted properly to pass verification tests.
2020
- It is now possible to use an empty binding path with a non empty override path.
2121
- It is now possible to use set an empty override path to disable a binding.
2222
- It is not possible to query the effectively used path of a binding using `effectivePath`.
23+
- Actions embedded into MonoBehaviour components can now have their properties edited in the inspector. Previously there was no way to get to the properties in this workflow. There is a gear icon now on the action that will open the action properties.
2324

2425
### Changed
2526
### Added

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,17 @@ private void DrawHeader(ref Rect rect)
10991099
AddNewActionMap();
11001100
}
11011101
}
1102+
1103+
buttonRect.x -= buttonRect.width + EditorGUIUtility.standardVerticalSpacing;
11021104
}
11031105
}
1106+
1107+
// Draw action properties button.
1108+
if (drawActionPropertiesButton && rootItem is ActionTreeItem item)
1109+
{
1110+
if (GUI.Button(buttonRect, s_ActionPropertiesIcon, GUIStyle.none))
1111+
onDoubleClick?.Invoke(item);
1112+
}
11041113
}
11051114

11061115
// For each item, we draw
@@ -1251,6 +1260,7 @@ private bool ReloadIfSerializedObjectHasBeenChanged()
12511260
public bool drawHeader { get; set; }
12521261
public bool drawPlusButton { get; set; }
12531262
public bool drawMinusButton { get; set; }
1263+
public bool drawActionPropertiesButton { get; set; }
12541264
public float foldoutOffset { get; set; }
12551265

12561266
public Action<SerializedProperty> onHandleAddNewAction { get; set; }
@@ -1309,6 +1319,7 @@ private GUIContent plusIcon
13091319
private static readonly GUIContent s_PlusActionIcon = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add Action");
13101320
private static readonly GUIContent s_PlusActionMapIcon = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add Action Map");
13111321
private static readonly GUIContent s_DeleteSectionIcon = EditorGUIUtility.TrIconContent("Toolbar Minus", "Delete Selection");
1322+
private static readonly GUIContent s_ActionPropertiesIcon = EditorGUIUtility.TrIconContent("Settings", "Action Properties");
13121323

13131324
private static readonly GUIContent s_CutLabel = EditorGUIUtility.TrTextContent("Cut");
13141325
private static readonly GUIContent s_CopyLabel = EditorGUIUtility.TrTextContent("Copy");

Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionDrawerBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ private void InitTreeIfNeeded(SerializedProperty property)
4848
title = property.displayName,
4949
// With the tree in the inspector, the foldouts are drawn too far to the left. I don't
5050
// really know where this is coming from. This works around it by adding an arbitrary offset...
51-
foldoutOffset = 14
51+
foldoutOffset = 14,
52+
drawActionPropertiesButton = true
5253
};
5354
m_TreeView.Reload();
5455
}

0 commit comments

Comments
 (0)