Search Unity

Question Unity's new Input system does not work after building the game

Discussion in 'Input System' started by venay0, Jun 5, 2020.

  1. venay0

    venay0

    Joined:
    Aug 26, 2019
    Posts:
    7
    I've made a test project to test the new Input system pointers (touch and mouse), in the editor, everything works perfectly however when I build the game they don't. it's like there is not an input system. I'm not sure if I'm missing a setting or something.

    I've made simple sean where the Ui displays the available devices, whether they're enabled or not, and if a touch or mouse click detected it will display general information about it.

    this is how it works in the editor:




    And this is the android version, note that button press still works:



    I did not record the PC standalone version but it still does not respond.

    this is the link to the build:
    https://github.com/Venay/Input_test

    this is the code I used and a couple of screenshots of my settings:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.InputSystem;
    4.  
    5. namespace Testing.InputDebugger
    6. {
    7.     public class InputDebugger : MonoBehaviour
    8.     {
    9.         PointerInput pointerInput;
    10.         public Text inputText;
    11.         public Text deviceText;
    12.         public Text buttonText;
    13.  
    14.         private void Awake()
    15.         {
    16.             pointerInput = new PointerInput();
    17.             pointerInput.General.Pointer.performed += ctx => OnPointer(ctx.ReadValue<myCompositData>());
    18.             pointerInput.General.Pointer.canceled += ctx => OnPointer(ctx.ReadValue<myCompositData>());
    19.  
    20.             string text = "";
    21.  
    22.             foreach (var S in InputSystem.devices)
    23.             {
    24.                 text += S.device + " : " + S.enabled + "  \n";
    25.             }
    26.             deviceText.text = text;
    27.         }
    28.  
    29.         private void OnEnable() => pointerInput.Enable();
    30.         private void OnDisable() => pointerInput.Disable();
    31.  
    32.  
    33.  
    34.         public void OnPointer(myCompositData data)
    35.         {
    36.  
    37.             string n = "\n";
    38.             string Press = "Press: " + data.Press.ToString() + n;
    39.             string PressCount = "Press Count: " + data.PressCount + n;
    40.             string Position = "Position: " + data.Position + n;
    41.             string Delta = "Delta: " + data.Delta + n;
    42.             string Radius = "Radius: " + data.Radius + n;
    43.  
    44.             string Tap = "Tap: " + data.Tap + n;
    45.             string StartPosition = "Start Position: " + data.StartPosition + n;
    46.             string StartTime = "Start Time: " + data.StartTime + n;
    47.  
    48.             string Scroll = "Scroll: " + data.Scroll + n;
    49.  
    50.             inputText.text = Time.time + n + Press + PressCount + Position + Delta + Radius + n + Tap + StartPosition + StartTime + n + Scroll;
    51.  
    52.         }
    53.  
    54.         public void OnButtonPress() => buttonText.text = "Pressed at:\n" + Time.time;
    55.     }
    56.  
    57.  
    58. }
    59.  

     
    Oneiros90, akyyewale and ahaghdan like this.
  2. AronTD

    AronTD

    Joined:
    Aug 31, 2013
    Posts:
    22
    I'm having a similar issue with an Xbox Elite controller.
     
    Erwon likes this.
  3. Erwon

    Erwon

    Joined:
    Apr 6, 2021
    Posts:
    2
    Yeah me too with a ps4 controller.
     
  4. Oneiros90

    Oneiros90

    Joined:
    Apr 29, 2014
    Posts:
    78
    Same problem with a simple Xbox One controller and Windows build. Any news?