Search Unity

Bug Player Input Component not working / triggering Actions in mobile build (works fine in editor)

Discussion in 'Input System' started by Fly81, May 20, 2022.

  1. Fly81

    Fly81

    Joined:
    Oct 6, 2021
    Posts:
    34
    Hi,
    As said in the title: I have the New Input System set up in my project (Unity v2021.3.0f1, New Input System v1.3.0) and a GameObject uses the Player Input Component.with my custom input actions.

    I have an On-Screen-Stick that's supposed to trigger the "Aim" action, and a "Test" action triggering when detecting any touch input at all for test purposes.



    And everything works fine when executed in the editor in the phone simulator, but when I build to my phone (Android) it doesn't. The actions do not get triggered.
    What works in the build, is creating an object of my input actions class and subscribing to the actions directly like this:

    Code (CSharp):
    1. void Awake() {
    2.     inputActions = new PlayerInputActions();
    3. }
    4.  
    5. void Start() {
    6.     inputActions.PlayerAim.Enable();
    7.  
    8.     inputActions.PlayerAim.Aim.performed += OnAim;
    9.     inputActions.PlayerAim.Aim.canceled += OnAim;
    10. }
    (I have two OnAim functions, one taking an InputValue and one taking the CallbackContext and in the editor they both get called as they should...)

    I would really like to use the Player Input Component though. Am I missing something?
     
    emredesu likes this.