@@ -32,7 +32,7 @@ public static Command RemoveDeviceRequirement(int selectedDeviceIndex)
32
32
} ;
33
33
}
34
34
35
- public static Command SaveControlScheme ( bool updateExisting = false )
35
+ public static Command SaveControlScheme ( string newName = "" , bool updateExisting = false )
36
36
{
37
37
return ( in InputActionsEditorState state ) =>
38
38
{
@@ -53,7 +53,7 @@ public static Command SaveControlScheme(bool updateExisting = false)
53
53
controlScheme = controlSchemesArray . GetArrayElementAtIndex ( controlSchemesArray . arraySize - 1 ) ;
54
54
}
55
55
56
- controlScheme . FindPropertyRelative ( nameof ( InputControlScheme . m_Name ) ) . stringValue = controlSchemeName ;
56
+ controlScheme . FindPropertyRelative ( nameof ( InputControlScheme . m_Name ) ) . stringValue = string . IsNullOrEmpty ( newName ) ? controlSchemeName : newName ;
57
57
58
58
var serializedDeviceRequirements = controlScheme . FindPropertyRelative ( nameof ( InputControlScheme . m_DeviceRequirements ) ) ;
59
59
serializedDeviceRequirements . ClearArray ( ) ;
@@ -71,8 +71,7 @@ public static Command SaveControlScheme(bool updateExisting = false)
71
71
}
72
72
73
73
state . serializedObject . ApplyModifiedProperties ( ) ;
74
-
75
- return state . With ( selectedControlSchemeIndex : controlSchemesArray . arraySize - 1 ) ;
74
+ return state . With ( selectedControlScheme : new InputControlScheme ( controlScheme ) ) ;
76
75
} ;
77
76
}
78
77
@@ -137,7 +136,7 @@ public static Command DeleteSelectedControlScheme()
137
136
} ;
138
137
}
139
138
140
- private static string MakeUniqueControlSchemeName ( InputActionsEditorState state , string name )
139
+ internal static string MakeUniqueControlSchemeName ( InputActionsEditorState state , string name )
141
140
{
142
141
var controlSchemes = state . serializedObject . FindProperty ( nameof ( InputActionAsset . m_ControlSchemes ) ) ;
143
142
@@ -165,15 +164,6 @@ public static Command ChangeDeviceRequirement(int deviceRequirementIndex, bool i
165
164
} ;
166
165
}
167
166
168
- public static Command ChangeSelectedControlSchemeName ( string controlSchemeName )
169
- {
170
- return ( in InputActionsEditorState state ) => state . With (
171
- selectedControlScheme : new InputControlScheme (
172
- controlSchemeName ,
173
- state . selectedControlScheme . deviceRequirements ,
174
- state . selectedControlScheme . m_BindingGroup ) ) ;
175
- }
176
-
177
167
public static Command ReorderDeviceRequirements ( int oldPosition , int newPosition )
178
168
{
179
169
return ( in InputActionsEditorState state ) =>
0 commit comments