@@ -155,11 +155,11 @@ public InteractiveRebindEvent stopRebindEvent
155155
156156 /// <summary>
157157 /// Return the action and binding index for the binding that is targeted by the component
158- /// according to
158+ /// according to the binding ID property.
159159 /// </summary>
160- /// <param name="action"></param>
161- /// <param name="bindingIndex"></param>
162- /// <returns></returns>
160+ /// <param name="action">The action returned by reference. </param>
161+ /// <param name="bindingIndex">The binding index returned by reference. </param>
162+ /// <returns>true if able to resolve, otherwise false. </returns>
163163 public bool ResolveActionAndBinding ( out InputAction action , out int bindingIndex )
164164 {
165165 bindingIndex = - 1 ;
@@ -172,8 +172,8 @@ public bool ResolveActionAndBinding(out InputAction action, out int bindingIndex
172172 return false ;
173173
174174 // Look up binding index.
175- var bindingId = new Guid ( m_BindingId ) ;
176- bindingIndex = action . bindings . IndexOf ( x => x . id == bindingId ) ;
175+ var id = new Guid ( m_BindingId ) ;
176+ bindingIndex = action . bindings . IndexOf ( x => x . id == id ) ;
177177 if ( bindingIndex == - 1 )
178178 {
179179 Debug . LogError ( $ "Cannot find binding with ID '{ bindingId } ' on '{ action } '", this ) ;
@@ -256,7 +256,8 @@ private void PerformInteractiveRebind(InputAction action, int bindingIndex, bool
256256 {
257257 m_RebindOperation ? . Cancel ( ) ; // Will null out m_RebindOperation.
258258
259- var actionWasEnabledPriorToRebind = action . enabled ; // Allow restoring enabled state
259+ // Extract enabled state to allow restoring enabled state after rebind completes
260+ var actionWasEnabledPriorToRebind = action . enabled ;
260261
261262 void CleanUp ( )
262263 {
@@ -266,8 +267,6 @@ void CleanUp()
266267 // Restore action enabled state based on state prior to rebind
267268 if ( actionWasEnabledPriorToRebind )
268269 action . actionMap . Enable ( ) ;
269-
270- m_UIInputActionMap ? . Enable ( ) ;
271270 }
272271
273272 // An "InvalidOperationException: Cannot rebind action x while it is enabled" will
@@ -282,7 +281,6 @@ void CleanUp()
282281 // the action map containing the target action if it was initially enabled.
283282 if ( actionWasEnabledPriorToRebind )
284283 action . actionMap . Disable ( ) ;
285- m_UIInputActionMap ? . Disable ( ) ;
286284
287285 // Configure the rebind.
288286 m_RebindOperation = action . PerformInteractiveRebinding ( bindingIndex )
@@ -348,8 +346,6 @@ protected void OnEnable()
348346 s_RebindActionUIs . Add ( this ) ;
349347 if ( s_RebindActionUIs . Count == 1 )
350348 InputSystem . onActionChange += OnActionChange ;
351- if ( m_DefaultInputActions != null && m_UIInputActionMap == null )
352- m_UIInputActionMap = m_DefaultInputActions . FindActionMap ( "UI" ) ;
353349 }
354350
355351 protected void OnDisable ( )
@@ -419,12 +415,6 @@ private static void OnActionChange(object obj, InputActionChange change)
419415 [ SerializeField ]
420416 private Text m_RebindText ;
421417
422- [ Tooltip ( "Optional reference to default input actions containing the UI action map. The UI action map is "
423- + "disabled when rebinding is in progress." ) ]
424- [ SerializeField ]
425- private InputActionAsset m_DefaultInputActions ;
426- private InputActionMap m_UIInputActionMap ;
427-
428418 [ Tooltip ( "Event that is triggered when the way the binding is display should be updated. This allows displaying "
429419 + "bindings in custom ways, e.g. using images instead of text." ) ]
430420 [ SerializeField ]
0 commit comments