@@ -26,7 +26,7 @@ public sealed class InputControlPathEditor : IDisposable
26
26
/// <param name="onModified">Delegate that is called when the path has been modified.</param>
27
27
/// <param name="label">Optional label to display instead of display name of <paramref name="pathProperty"/>.</param>
28
28
/// <exception cref="ArgumentNullException"><paramref name="pathProperty"/> is <c>null</c>.</exception>
29
- public InputControlPathEditor ( SerializedProperty pathProperty , InputControlPickerState pickerState , Action onModified , GUIContent label = null )
29
+ public InputControlPathEditor ( SerializedProperty pathProperty , InputControlPickerState pickerState , Action < string > onModified , GUIContent label = null )
30
30
{
31
31
if ( pathProperty == null )
32
32
throw new ArgumentNullException ( nameof ( pathProperty ) ) ;
@@ -89,7 +89,7 @@ public void OnGUI()
89
89
EditorGUILayout . EndHorizontal ( ) ;
90
90
}
91
91
92
- public void OnGUI ( Rect rect , GUIContent label = null , SerializedProperty property = null , Action modifiedCallback = null )
92
+ public void OnGUI ( Rect rect , GUIContent label = null , SerializedProperty property = null , Action < string > modifiedCallback = null )
93
93
{
94
94
var pathLabel = label ?? m_PathLabel ;
95
95
var serializedProperty = property ?? pathProperty ;
@@ -141,7 +141,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
141
141
{
142
142
serializedProperty . stringValue = path ;
143
143
serializedProperty . serializedObject . ApplyModifiedProperties ( ) ;
144
- ( modifiedCallback ?? onModified ) . Invoke ( ) ;
144
+ ( modifiedCallback ?? onModified ) . Invoke ( path ) ;
145
145
}
146
146
}
147
147
else
@@ -151,7 +151,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
151
151
{
152
152
SetExpectedControlLayoutFromAttribute ( serializedProperty ) ;
153
153
////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field
154
- ShowDropdown ( bindingTextRect , serializedProperty , modifiedCallback ?? onModified ) ;
154
+ ShowDropdown ( bindingTextRect , modifiedCallback ?? onModified ) ;
155
155
}
156
156
}
157
157
@@ -160,7 +160,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
160
160
EditorStyles . miniButton ) ;
161
161
}
162
162
163
- private void ShowDropdown ( Rect rect , SerializedProperty serializedProperty , Action modifiedCallback )
163
+ private void ShowDropdown ( Rect rect , Action < string > modifiedCallback )
164
164
{
165
165
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
166
166
InputActionsEditorSettingsProvider . SetIMGUIDropdownVisible ( true , false ) ;
@@ -171,19 +171,16 @@ private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Acti
171
171
m_PickerState ,
172
172
path =>
173
173
{
174
- serializedProperty . stringValue = path ;
175
174
m_PickerState . manualPathEditMode = false ;
176
- modifiedCallback ( ) ;
175
+ modifiedCallback ( path ) ;
177
176
} ) ;
178
177
}
179
178
180
179
m_PickerDropdown . SetPickedCallback ( path =>
181
180
{
182
181
//At this point, the serialized property can sometines be referencing the old input actions asset
183
- Debug . Log ( serializedProperty . serializedObject . targetObject . GetInstanceID ( ) ) ;
184
- serializedProperty . stringValue = path ;
185
182
m_PickerState . manualPathEditMode = false ;
186
- modifiedCallback ( ) ;
183
+ modifiedCallback ( path ) ;
187
184
} ) ;
188
185
189
186
m_PickerDropdown . SetControlPathsToMatch ( m_ControlPathsToMatch ) ;
@@ -204,7 +201,7 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property)
204
201
}
205
202
206
203
public SerializedProperty pathProperty { get ; }
207
- public Action onModified { get ; }
204
+ public Action < string > onModified { get ; }
208
205
209
206
private GUIContent m_PathLabel ;
210
207
private string m_ExpectedControlLayout ;
@@ -215,6 +212,7 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property)
215
212
private InputControlPickerDropdown m_PickerDropdown ;
216
213
private readonly InputControlPickerState m_PickerState ;
217
214
private InputActionRebindingExtensions . RebindingOperation m_RebindingOperation ;
215
+
218
216
}
219
217
}
220
218
#endif // UNITY_EDITOR
0 commit comments