Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

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


    Oct 6, 2021
    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. }
    5. void Start() {
    6.     inputActions.PlayerAim.Enable();
    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.