Search Unity

On-Screen controls don't "release" when using a player input component

Discussion in 'Input System' started by Skotrap7, Jun 9, 2021.

  1. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    125
    Following the instructions here and here for using On-Screen buttons, I am experiencing an issue where the button gets "stuck" in it's pressed state when I have a PlayerInput component added to the scene.

    Repo steps:

    1. New project -> Import Input System package -> Import On-Screen Controls example content
    2. Open the OnScreenControlsSample scene
    3. Select the EventSystem GameObject from the Hierarchy (note that the EventSystem is still using the standalone module)
    4. Click the "Replace with InputSystemUIInputModule" Button
    5. Add a "PlayerInput" component (I added it to the same GameObject as the EventSystem, but it doesn't seem to matter) and set it to the same InputActionsAsset as the EventSystem component (DefaultInputActions from the Input System Package)
    6. Drag/Drop the EventSystem GO to the UI Input Module field and the Main Camera to the Camera field
    7. Enter Play mode and click the X or Y button. Notice they grey out and no longer respond to input.

    Interestingly enough, if you build this for Android and put it on a phone, the same happens with the X, Y and A and B.

    Also, the sticks no longer automatically return to their normal positions as they did without the PlayerInput Component.

    For giggles you can disable/enable the PlayerInput Component only and see that doing so changes the behavior of these On-Screen controls. Even while in Play Mode enabling this component causes these controls behaviors to change.

    Feels like a bit of an important bug...

    I tried to attach a project that demonstrates this issue, but it says my upload is too big. I'm not sure what I can exclude from the project that will be sufficient for attaching it here, but following those repro steps I've been able to repro this myself multiple times.
     
  2. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    125
    Apparently, on-screen controls will work fine when using the generated C# class but not when using the PlayerInput component. Anyone have any clues here? For now I'll just generate the C# class I guess, but would love to get this working correctly with the components.
     
  3. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Skotrap7, would you mind reporting this as a bug (Help->Report a bug) with repro project please? Thanks!
     
  4. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    125
    Done. Thanks for responding. I didn't know how to report a bug before.
     
  5. samyam_

    samyam_

    Joined:
    Jun 29, 2017
    Posts:
    10
    I'm able to use a PlayerInput component and an On-Screen joystick when the PlayerInput action asset is different than the one the EventSystem uses, but the sample doesn't seem to work for me when using the same asset.
    Unity v2020.2.7f1 & Input System v1.1.0-preview.3
     
  6. aallbright

    aallbright

    Joined:
    Sep 3, 2020
    Posts:
    5
    Any word on this? I just encountered this issue. :(
     
  7. alex_dossamer

    alex_dossamer

    Joined:
    Jun 19, 2018
    Posts:
    25
    Hello! I'm on 2021.3.19, input system 1.5.0 and also running into the issue of on-screen sticks working in the mobile device simulator on desktop, but not on an actual android device. Blocking issue for me. Thanks!

    edit: the issue was unrelated-- the sticks were broken because my canvas was using a screenspace overlay relative to the main camera, not one relative to the display. Should maybe be noted in the documentation; took me over an hour to figure out. Cheers!
     
    Last edited: Feb 22, 2023