Skip to content

Commit 2002822

Browse files
Fixing button "Assign as the settings"
1 parent a500b2b commit 2002822

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

Packages/com.unity.inputsystem/InputSystem/Editor/InputAssetEditorUtils.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,19 @@ public static VisualElement CreateMakeActiveGui<T>(T current, T target, string t
8787
where T : ScriptableObject
8888
{
8989
var container = new VisualElement();
90+
PopulateMakeActiveGui(container, current, target, entity, apply, allowAssignActive);
91+
return container;
92+
}
93+
94+
private static void PopulateMakeActiveGui<T>(VisualElement container, T current, T target, string entity, Action<T> apply, bool allowAssignActive)
95+
where T : ScriptableObject
96+
{
97+
container.Clear();
9098

9199
if (current == target)
92100
{
93101
container.Add(new HelpBox($"These actions are assigned as the {entity}.", HelpBoxMessageType.Info));
94-
return container;
102+
return;
95103
}
96104

97105
string currentlyActiveAssetsPath = null;
@@ -104,14 +112,16 @@ public static VisualElement CreateMakeActiveGui<T>(T current, T target, string t
104112
$"These actions are not assigned as the {entity} for the Input System. {currentlyActiveAssetsPath ?? ""}",
105113
HelpBoxMessageType.Warning));
106114

107-
var assignButton = new Button(() => apply(target))
115+
var assignButton = new Button(() =>
116+
{
117+
apply(target);
118+
PopulateMakeActiveGui(container, target, target, entity, apply, allowAssignActive);
119+
})
108120
{
109121
text = $"Assign as the {entity}"
110122
};
111123
assignButton.SetEnabled(allowAssignActive);
112124
container.Add(assignButton);
113-
114-
return container;
115125
}
116126

117127
public static bool IsValidFileExtension(string path)

0 commit comments

Comments
 (0)