Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Could not find active control after binding resolution

Discussion in 'Input System' started by Gabriel_NR, Feb 23, 2023.

  1. Gabriel_NR

    Gabriel_NR

    Joined:
    Jan 21, 2018
    Posts:
    3
    Screenshot 2023-02-22 at 6.03.16 PM.png

    Code (CSharp):
    1. Could not find active control after binding resolution
    2. UnityEngine.InputSystem.OnScreen.OnScreenControl:OnDisable () (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Plugins/OnScreen/OnScreenControl.cs:231)
    This is for a mobile game using two UI Images as controls, one with an On-Screen Button component, and one with an On-Screen Stick component. I only receive this error after ending Play Mode, not during, when I used my mouse to touch the buttons in the Simulator, or with the remote app. During Play mode everything acts as it should, and if I don't click the buttons with my mouse and instead use my keyboard I won't receive the error.

    As everything works properly during play in the Editor I normally wouldn't care, but I believe this is related to an issue I'm having where when actually built and loaded onto an iPhone the touch controls don't work properly. They are incredibly laggy and only respond when pressed occasionally. The game itself is an extremely lightweight 2D proof of concept, so it isn't a case of being too much for the phone.

    I'm currently using Unity 2021.3.19f1 with Input System 1.5.0, but this is after upgrading from an earlier version to see if that would fix it. I don't remember the previous version exactly, just that it was 1.4.something.

    Any advice on what I can try in order to fix it? Or is there additional information I should provide that I haven't?
     
  2. vitorfgd

    vitorfgd

    Joined:
    Nov 4, 2014
    Posts:
    27
    I'm having the same problem. Did you manage to solve?
     
  3. 71kris

    71kris

    Joined:
    Aug 13, 2013
    Posts:
    17
    Bump. Same issue here. I think I've managed to resolve it. See [my resolution] below.
    Unity 2021.3.21, Input System 1.5.1, issue on previous 1.4 was also there.

    No errors in the Editor but when deployed to Android mobile it throws errors like the one GabrielDPeterson raised in this ticket (above).
    I've tried to resolve it but I can't. Can anyone from Unity help, please?

    Game Scene ->
    On button click ->
    call -> GoToMenu() ->
    triggers SceneManager.LoadScene("Menu") ->
    navigates to Menu Scene OK but also throws OnDisable errors.

    [my resolution]
    1. I reviewed again my Custom Input System Asset (bindings set-up in the Editor).
    2. I refactored reading Vector2 x and y (code below).
    3. my 'Move' (movement) binding in the Editor - I changed my 'Move' - composite binding Vector2 to:
    Composite Type: 2D Vector
    Mode: Analog (I had it set-up as Digital Normalized)

    Here's my code related to OnEnable and OnDisable.

    Code (CSharp):
    1.  
    2. public Player playerInput;
    3.  
    4. private void Awake()
    5.     {
    6.         // Input System 1.5.1 - opt-in for now requires this to be set in project:
    7.         // https://docs.unity3d.com/Packages/com.unity.inputsystem@1.5/changelog/CHANGELOG.html
    8.         InputSystem.settings.SetInternalFeatureFlag("USE_OPTIMIZED_CONTROLS", true);
    9.         InputSystem.settings.SetInternalFeatureFlag("USE_READ_VALUE_CACHING", true);
    10.      InputSystem.settings.SetInternalFeatureFlag("PARANOID_READ_VALUE_CACHING_CHECKS", true);
    11.         playerInput = new Player(); // Custom Input System Asset
    12. }
    13. private void OnEnable()
    14.     {
    15.         playerInput.Enable();
    16.         playerInput.PlayerMain.Move.performed += OnMovementPerformed;
    17.         playerInput.PlayerMain.Move.canceled += OnMovementCanceled;
    18.     }
    19.     private void OnDisable()
    20.     {
    21.         playerInput.Disable();
    22.         playerInput.PlayerMain.Move.performed -= OnMovementPerformed;
    23.         playerInput.PlayerMain.Move.canceled -= OnMovementCanceled;
    24.     }
    25.  
    26.     private void OnMovementPerformed(InputAction.CallbackContext value)
    27.     {
    28.         movementInput = value.ReadValue<Vector2>();
    29.     }
    30.     private void OnMovementCanceled(InputAction.CallbackContext value)
    31.     {
    32.         movementInput = Vector2.zero;
    33.     }
    With these changes in place I no longer get OnDisable errors on android mobile.

    One more thing is that when I reviewed my custom input asset (bindings) I removed not requied extra binding for LeftStick Gamepad. I had in fact 2 bindings for on screen Movement. It could be that one of these two was throwing errors.
    If I find any further issues I'll let you know. For now it seems I managed to resolve it.
     
    Last edited: Mar 27, 2023
    zeimhall likes this.
  4. Gabriel_NR

    Gabriel_NR

    Joined:
    Jan 21, 2018
    Posts:
    3
    BobNuromedia likes this.
  5. real_hungle

    real_hungle

    Joined:
    Dec 15, 2018
    Posts:
    1
    Hello everyone, I've found a solution to my problem: Previously, I had selected Android as my output platform in Unity, and then I added an On-Screen Button to a UI with the Control Path set to Escape[Keyboard]. The purpose was to enable the exit menu when the button was pressed. As long as I enabled this Escape[Keyboard] On-Screen Button, I would encounter this error when closing the game or switching scenes. So, I guess this might be because the Android platform couldn't find the Esc key, causing the error. Once I hid this UI, the issue never occurred again.

    upload_2023-5-3_2-26-9.png
     
  6. BobNuromedia

    BobNuromedia

    Joined:
    Jan 18, 2022
    Posts:
    2
    This fixed it for me - THANX!
     
  7. dailafing

    dailafing

    Joined:
    Feb 21, 2019
    Posts:
    1
    Dead link for me.... I wish things like this wouldn't disappear... so does anyone have the solution for me? Thanks
     
  8. samol2014

    samol2014

    Joined:
    Oct 17, 2019
    Posts:
    4
  9. Kustuk

    Kustuk

    Joined:
    May 29, 2016
    Posts:
    22
    Just got the same issue - it is happening every time I reload a scene with scene manager.
    Interestingly I see this error but everything seems to be working anyways.
    Also calling
    InputSystem.DisableAllEnabledActions();
    in OnDisable removes the errors but I didn't find a way to enable it back after scene reloaded.
     
  10. Kustuk

    Kustuk

    Joined:
    May 29, 2016
    Posts:
    22
    In my case it was fixed by setting a InputActionMap asset to the EventSystem instead of the default one from the InputSystem package.
     
    jayb7 likes this.
  11. jayb7

    jayb7

    Joined:
    Jun 10, 2020
    Posts:
    8
    How do you do this ?