Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Controller bindings not working after Build

Discussion in 'Input System' started by SenorNeusAap, Sep 29, 2019.

  1. SenorNeusAap

    SenorNeusAap

    Joined:
    Dec 5, 2016
    Posts:
    4
    Hello,

    This is the first time that I am using the new Input System. So I want to state that I might have made a stupid mistake :p

    I mapped my "wasd" keys and left stick of the gamepad, to the X axis of my character. The player moves when I run my game in the Unity Editor. But as soon as I build the game (to Windows) and run it in my standalone .exe file, the controller input is no longer working. I am still able to use the keyboard (also via the new Input System).

    I am wondering if this is a problem/mistake i'm making with the library, or that Windows 10 is just screwing me over. Do I need to enable something extra? Anybody have an idea of what I might be doing wrong?

    This is my action mapping:
    upload_2019-9-29_21-33-4.png

    This is my PlayerControllerScript:
    Code (CSharp):
    1.     public float speed = 200;
    2.     private Rigidbody2D rb;
    3.     MainControls controls;
    4.     Vector2 move;
    5.  
    6.     void Awake()
    7.     {
    8.         controls = new MainControls();
    9.         controls.Main.Restart.performed += ctx => Restart();
    10.         controls.Main.Move.performed += ctx => move = ctx.ReadValue<Vector2>();
    11.         controls.Main.Move.canceled += ctx => move = Vector2.zero;
    12.         SpriteRenderer _sprR = this.GetComponent<SpriteRenderer>();
    13.         _sprR.color = new Color(Random.Range(0F, 1F), Random.Range(0, 1F), Random.Range(0, 1F));
    14.     }
    15.  
    16.     private void FixedUpdate()
    17.     {
    18.         //float moveHorizontal = Input.GetAxis("Horizontal") * speed;
    19.         Vector2 movement = speed * move;
    20.         rb.AddForce(movement);
    21.         //rb.AddForce(new Vector2(moveHorizontal,0.0f));
    22.     }
    23.  
    24.     void OnEnable()
    25.     {
    26.         controls.Main.Enable();
    27.     }
    28.  
    29.     void OnDisable()
    30.     {
    31.         controls.Main.Disable();
    32.     }
    These are my Input System Package settings:
    upload_2019-9-29_21-42-47.png

    This is my Windows Device Manager (does not show up as PS4 controller, which I believe it never does):
    upload_2019-9-29_21-39-50.png

    I also tried putting the update of the "move" variable into FixedUpdate like:
    move = control.Main.Move.ReadValue<Vector2>();

    And setting "Update Method" in the "Input System Package" to FixedUpdates.

    This did not alter the outcome as well.

    Thanks in advance for all the help!

    With kind regards,
    Mats
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    There shouldn't be a need for enabling anything extra.

    To debug this, could you build a development player and run it and then connect the input debugger? (there's a "Remote Devices..." dropdown; when your player is running, you should see in the list and be able to connect it; the input debugger is found in the editor under "Window >> Analysis >> Input Debugger")

    When you're connected, you should see the devices from the connected player in their own branch. Is the gamepad there?
     
  3. SenorNeusAap

    SenorNeusAap

    Joined:
    Dec 5, 2016
    Posts:
    4
    That is an awesome feature! Handy to know. Thank you.

    Looks like that the controller is indeed not found under the remote section (Only the keyboard):
    upload_2019-9-30_19-59-14.png

    Maybe I am doing something wrong with the "Player Input" field on my player GameObject?:

    I tried to Build the game without this element attached to my GameObject (which gives the same results as with the Player Input attached).

    I do not need any extra drivers for the PS4 controller right? Or do I need extra software like DS4Windows?

    Do you maybe have more suggestions on how I could debug/figure out how to make it connect when remote?

    Thanks in advance!

    EDIT:

    Ah, just realized that Unity gives a yellow warning. Does not really seem to sound related, but maybe I am missing a hint to the answer here?:
     
    Last edited: Sep 30, 2019
  4. Hookkshot

    Hookkshot

    Joined:
    Jan 11, 2013
    Posts:
    27
    I also have this issue, My 3 xbox, 1 Playstation controller work fine in editor. But are not detected when I build and run the game.
    I am using Preview 1.0.0
     
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,069
  6. Hookkshot

    Hookkshot

    Joined:
    Jan 11, 2013
    Posts:
    27
    I am not home at the moment but I am using Input System Preview 1.0.0 with Unity 2019.2.2f1
     
  7. SenorNeusAap

    SenorNeusAap

    Joined:
    Dec 5, 2016
    Posts:
    4
    Even though I am following this thread, I did not recieve an E-Mail about your reply. I will try to update my unity editor and use the dev branch when I get home after work. I will let you know if that fixed it, or if not, I will submit a bug report via the editor and also let you know!

    Thanks in advance!
     
  8. gabros19

    gabros19

    Joined:
    May 19, 2019
    Posts:
    1
    I got the same problem here, using Unity 2019.2.5f1, Input System Version 0.9.6 and 1.0.0

    Edit: I created a new project in Unity 2019.2.8f1 with a canvas and 3 buttons, added the new Input System and added on the EventSystem the Input System UI Input Module Component and still the same problem. It works on the Editor with a gamepad but not on a builded version. I also reported the bug.
     
    Last edited: Oct 11, 2019
  9. SenorNeusAap

    SenorNeusAap

    Joined:
    Dec 5, 2016
    Posts:
    4
    It started working for me, I updated my Unity Editor to version 2019.3.0b6 and with InputSystem preview.1 - 1.0.0
    It switches kind of funky between keyboard inputs and controller inputs, but it does work inside the editor, and when I build my game.

    EDIT: It does only seem to work if I put my Build architecture on "x86_64", instead of "x86"

    Thanks for you information. Updating did seem to work. Also thanks to all the other Unity Developers working on this package. You guys are doing a wicked job!

    EDIT: Any clue why it might only work when building on a 64bit argitecture?
     
    Last edited: Oct 15, 2019
  10. NorthOfEarth

    NorthOfEarth

    Joined:
    Jul 3, 2012
    Posts:
    16
    Sorry to resurrect, but has there been any update on this? I'm on the latest version and the problem is still occurring. Gamepads only work on 64-bit builds.
     
  11. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,069
    I just tried this here with the latest 19.3 + 1.0 and xboxone gamepad. Works fine in editor, x86 and x86_64.

    If that doesn't work for you, please do file a bug report and mention the exact model of the gamepad you are using.
    Thanks!
     
  12. dylan_unity619

    dylan_unity619

    Joined:
    Feb 28, 2020
    Posts:
    1
    I had this problem while working on a prototype. My Xbox360 controller would work fine in-editor but not in a built version.
    I was able to fix this by going into my PlayerController script, and changing
    gamepad = Gamepad.current;

    to
    gamepad = InputSystem.GetDevice<Gamepad>();


    My assumption is that the editor automatically detects input devices and sets it to "current", but a built version does not do this, so "current" remains unititialized. I have not investigated thoroughly enough to put money on this guess, but hopefully this solution helps people.
     
  13. unity_ZRUFkInHN3eTUg

    unity_ZRUFkInHN3eTUg

    Joined:
    Apr 6, 2020
    Posts:
    1
    was wondering where i could find the PlayerController script i can not find the gamepad variable that your talking about
     
  14. RoyorGames

    RoyorGames

    Joined:
    Mar 14, 2017
    Posts:
    25
    Hi

    @Schubkraft
    I have reported this a little while ago (with an uploaded project).
    It has case 1230296 and Unity version 2020.1.0b2_14d43bf8b596.

    It does not seem to be prioritized. Should I create a new bug with the current Unity Alpha or just be patient =)

    Best regards Povl
     
  15. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,069
  16. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    Having similar problem with keyboard, on an OSX build, so I can't change from x86 to x86_64.

    FWIW, a couple observations I can't repro reliably:

    Also some strangeness in the editor with key bindings that weren't pressed firing off at scene start in editor... sometimes. Only happens on my mac, my partner doesn't ever see it on PC. Don't know if it would happen in the player because input doesn't work at all there.

    I have a space key binding that always works on my computer, but never works on his.
     
  17. kendallroth

    kendallroth

    Joined:
    Nov 4, 2015
    Posts:
    20
    I can confirm that it is still necessary to use
    x86_64
    mode; however, I'm having this problem in the runtime build while using two controllers (or just one, explained here). I have a Logitech controller that I had to create a custom mapping for, which work successfully in the Editor. However, in the build only the PS4 controller works; any ideas why? Both devices show up in the Remote list but neither actually show any values, even though the PS4 controller works as expected... (in Local list both show input).
     
  18. Kyu_bo

    Kyu_bo

    Joined:
    Jul 20, 2017
    Posts:
    1
    Hey i am having the same problem. Everything works fine in the editor but as soon as i built my project the actions with a "2D Vector Composit" wont get executed right.
    A workaround for me was to change the actions from "2D Vector Composits" to "1D Axis Composites". This way i am mapping the A and D keys to one single Action for my Horizontal Movement and the W and S keys to one for my Vertical Movement.
    Maybe this can help some of you. It is not how its intended but it gets the job done. (At least for me)
    This only works when the built is x86_64.

    (Im working with Unity 2019.3.13 and Input System 1.0.0)

    Actions.png
     
    Last edited: May 15, 2020
  19. shadiradio

    shadiradio

    Joined:
    Jun 22, 2013
    Posts:
    83
    I'm having similar issues to this (2020.1.0b13) on both OSX and Windows builds:
    • Sometimes as you mentioned all my inputs are firing off when the scene starts and I have to clear them out by pressing all of them.
     
    Last edited: Jul 3, 2020
  20. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    48
    I have a similar issue in 2019.4.8f1. My wireless DS4 works fine in the editor even when using DS4Windows in both XBox mode and PS4 mode. While in a x86 build the controller is only detected when I set the controller in DS4Windows as an XBox controller. But in a x86_64 build the DS4 is detected with and without DS4Windows
     
  21. Owlbear_Headspin

    Owlbear_Headspin

    Joined:
    Jun 25, 2016
    Posts:
    6
    I'm having the same problem. I'm running 2019.4.6f1. Both PS4 and XboxOne controllers work fine in editor using the new input system. But with a x86 Windows build only the XboxOne controller (and keyboard) works. I'm actually using the hybrid option (old and new input system). All of the old inputs work (even with the PS4 controller). Just none of the new inputs on the PS4 controller.

    EDIT: My bad. After I put my Build architecture on "x86_64", instead of "x86" everything worked fine.
     
    Last edited: Aug 30, 2020
  22. AronTD

    AronTD

    Joined:
    Aug 31, 2013
    Posts:
    22
    I'm having this issue with an Xbox Elite controller even if I build in "x86_64"
     
  23. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    I have this problem too, where my XBOX Gamepad works fine in Editor but not in a build version. However, In my Input debug-window, the gamepad DOES however show in the remote section running development build. It's input is not propagated and does nothing, however. How can I troubleshoot this?
     
  24. Redmarian

    Redmarian

    Joined:
    Jul 6, 2017
    Posts:
    8
    I'm still having the same very basic problem with unity 2020.2.1f1 and Input system 1.0.2
    I basculated in x86_64,
    It works perfectly fine in Editor
    Once I build, I can only use keyboard arrows and associated keybord keys (zqsd in may case, as I work in azerty).
    It's been a month I'm trying to get a solution on this, I first thought it was adressable related, but no. SO I'm like @AronTD .
     
  25. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,219
    We support Unity Input System in Sci-Fi Ship Controller and Sticky3D Controller and haven't had any major issues between the editor and builds in 2020.2.x. Just upgraded a project from 1.0.1 to 1.0.2 and could still get XBox One gamepad input ok. I used U2020.2.0f1 on Win 10 Pro with x64 build.

    How are you reading input in your code?
     
  26. Redmarian

    Redmarian

    Joined:
    Jul 6, 2017
    Posts:
    8
    @sstrong I basically followed the tutorial. Perfectly fine in an other test project with more or less the same code generated quite automatically by the player input component, really. Exactely the same except from the Localization, adressable and use of UI.

    So I don't quite know what I'm supposed to do.

    Just in case I deleted my old one and redo the manuver from scratch, an now event my keubord input doesn't work in the build. Quite strange. Also tried to get in x86_64 to no avail. Everything is latest version in both tests (2020.2.1f1 and input system 1.0.2)
     
  27. Kretoskar

    Kretoskar

    Joined:
    Mar 15, 2019
    Posts:
    11
    Has anyone resolved this problem? It still occurs in Unity 2019.4.1f1 with Input system 1.0.1. Changing to x86_64 didn't work for me.
     
  28. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    469
    I also have this issue where everything works fine in editor but nothing works in the Build windows x64
    Using 1.0.0 preview-2 and unity 2019.4.9f1
    I troubleshoot a while ago be it had to do with my inputs not being enabled in build and nothing was attached to them. I didn't found a fix yet
     
    Last edited: Mar 3, 2021
  29. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    Any news on this problem?
     
  30. AronTD

    AronTD

    Joined:
    Aug 31, 2013
    Posts:
    22
    Still randomly running into this issue 3 months later. Seems flakey as it first didn't work, then worked, and now is again not working. I know the controller is good because it's detected by Windows.

    EDIT 1: It's now working again after I removed a deleted Scene from "Scenes In Build" and then hit "Build And Run". No idea if any of this is related.

    EDIT 2: Closed that out and ran again from exe in build folder. Now doesn't work again even after doing "Build And Run".
     
  31. CaptCanada

    CaptCanada

    Joined:
    Feb 3, 2013
    Posts:
    272
    I'm having the same issues as others here. I am running 2019.4.18f1 with the new input system.

    I am actually using the Roll A Ball tutorial and have come across this issue when try to create a build of the game in the tutorial.

    I can move the ball in Play mode but when I make a build of the game, nothing works. Not sure what's going on here.
    I thought it might be the Input System Manager in the Project Settings but I have that enabled in the Project Settings and and there was no difference.

    Am I missing something else?

    Thanks!
     
  32. FrankBuss

    FrankBuss

    Joined:
    Dec 22, 2014
    Posts:
    55
    Same problem here, after upgrading to Unity 2021.1.2f1. It worked before with an older version, now I can only use the keyboard when I build the game, no mouse. Mouse works only in the editor. Changing build settings from x86 to x86_64 doesn't fix it.

    Not impressed by the new input system so far. It makes things only more complicated, if you don't need the extra functionality of multiple controllers. I'm thinking about switching back to the old system, this works at least when building it.
     
  33. Z_Doctor

    Z_Doctor

    Joined:
    Jun 22, 2018
    Posts:
    6
    Frustratingly having an issue as well. Everything works as expected in the editor, but in a build for windows or webgl only the arrow keys seem to register. Was excited to use it for a game jam, but seems like it only works reliably on some machines. I'm using Unity 2021.1.4f1 personal using version 1.0.2 of the input system.

    Really is a shame, but glad I caught this early so I can remove it.
     
  34. FrankBuss

    FrankBuss

    Joined:
    Dec 22, 2014
    Posts:
    55
    I switched back to the old system. I guess as long as you don't need multiple individual controllers, this is the best solution to avoid beta-quality Unity libraries.
     
  35. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    Unity bug tracker says this is fixed, but I think I'm also up against this problem in 2019.4.11 and version Input System 1.0.2. https://issuetracker.unity3d.com/issues/windows-ds4-controller-doesnt-work-in-built-scene

    Strangely, it has been working for months now it's stopped working. The input device does show up in the Input Debugger on builds.

    If it's actually fixed, does anyone know where or how to get the fix? On the issue tracker page, all it says is "The fix is to the native runtime and not the Package itself" which isn't very helpful.
     
  36. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,069
    This means the fix landed in a build of Unity itself, not the input package. And it should work in the Unity version you are using. If not, please to file a new bug report ideally with a repro project so we can take a look.
     
  37. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    Thanks for the reply!

    I meant more that it wasn't very helpful because it doesn't say which version of Unity the fix was implemented in. In any event, I upgraded to 2019.4.27 a short while ago now all is well - I have been unable to reproduce it today.
     
    Schubkraft likes this.
  38. hernans1987

    hernans1987

    Joined:
    Sep 4, 2020
    Posts:
    4
    This is not fixed, im using Unity 2020.1.2f1 and input system V1.0.2 and on the editor everything works fine but when i build for PC, and run the EXE, the movement part is not working, the problem is with the Composite 2D vector, other simple input button bindings works correctly, for example i can Jump but i cant move around.

    upload_2021-6-5_15-21-18.png

    upload_2021-6-5_15-21-48.png

    upload_2021-6-5_15-22-55.png
     
  39. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,069
    For this then we'd greatly appreciate a new bug report with the input setup you have. Thanks in advance!
     
  40. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    70
    I'm using 2021.1.12f1 with Input System 1.0.2. I'm using the ECM2 asset from the store. The movement etc works fine in Play mode, but when I run a build, the input no longer works. The camera input is fine, but the player input doesn't do anything.
     
  41. cLick1338

    cLick1338

    Joined:
    Feb 23, 2017
    Posts:
    74
    Same issue here except with keyboard input. Input System 1.0.2, Unity 2021.1.15f.

    This is for the auto-created "Move" InputAction (Value, Vector2) - ReadValue<Vector2>() always returns (0,0) in a Win x64 build but works fine in Editor (didn't try other platforms).

    Other keyboard InputActions work as expected. The Input Debug picks up all key presses including movement ones for the "Remote device" keyboard.

    Curiously, gamepad input for the same "Move" InputAction works fine, and no, keyboard "Move" input doesn't work even with no gamepads connected and/or Action Type set to Pass Through.

    Adding a "Player Input Manager" changed nothing. Editor closed, restarts, clean rebuilds didn't help. It's not hard to do a workaround but it's a bit ridiculous.
     
  42. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    @Broudy001 @cLick1338 Long shot, but are you guys using Addressables? If so, did you do an Addressables build first?
     
  43. Broudy001

    Broudy001

    Joined:
    Feb 12, 2020
    Posts:
    70
    I'm not using addressables, for me it only seemed to be in a particular scene, when I changed to another scene it was ok, it was very odd.

    I found some references to the Steam Controller on other forums, but nothing definitive
     
  44. masiha128

    masiha128

    Joined:
    Oct 10, 2020
    Posts:
    1
    I found out that if I click build and run and don't close the editor it works fine but if I close the editor it does not work

    just know that I'm using 2020.3 LTS
     
  45. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    469
    How would this be related ? I'm building adressables first yes.
     
  46. Sylvator

    Sylvator

    Joined:
    Apr 10, 2018
    Posts:
    1
    Not sure what the issue was for you guys. But none of the above worked for me.
    However I changed the following: In 2D Vector for Keyboard, only Mode = Analog worked for me. Setting it to any of the others is causing it to fail.

    (Note: All the modes were working in the editor)
     
  47. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    I'm having issues with gamepads on the new InputSystem in standalone x86_64 builds, but it only reproduces if I'm activating the gamepad somehow (holding an analog to the side, etc) while it's launching. If I leave the gamepad completely alone, with no inputs pressed or otherwise activated, it works flawlessly from launch.

    Also, once I do get to the title screen in the broken state, if I move my mouse and switch it to Mouse input, then activate Gamepad again, it works correctly.

    2019.4.31f1
     
  48. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    I have the same problem at 2020.3.28f1
    I use DOTS, my Input Systems reads inputs from new system:

    Code (CSharp):
    1. public class PlayerControllerSystem : SystemBase
    2.     {
    3.         private PlayerControls _controls;
    4.  
    5.         protected override void OnCreate()
    6.         {
    7.             _controls = new PlayerControls();
    8.             _controls.Enable();
    9.         }
    10.  
    11.         [BurstCompile]
    12.         protected override void OnUpdate()
    13.         {
    14.             float2 moveAxis = _controls.PlayerMap.Move.ReadValue<Vector2>();
    Everything works great in the editor, and doesn't work in build (i'm building with platforms.windows)
     
  49. TabuuForteAkugun

    TabuuForteAkugun

    Joined:
    Sep 28, 2015
    Posts:
    58
    I've had this same problem since I updated to 2021.2.11f1. I'm using a Logitech Cordless dual-stick RumblePad with an Xbox 360 driver on it. Neither DirectInput OR XInput mode work. It just ceases to respond to any of my inputs at all.

    I have my events setup correctly (Unity Events, and a separate "menus" Action Map, and the inputs register on the Input Debugger. It would even work on characters before. But in the menus map, I can't get any response in-game out of the darn gamepad. (play mode OR a build). I tried everything: rebooting, copying the EXACT signature from my character input maps, etc. No dice.
     
  50. raiwin

    raiwin

    Joined:
    Jun 24, 2016
    Posts:
    8
    Controller does not work in build for x86_64.

    Using Unity 2019.4.24f1 with Input Sytem version 1.0.2

    I already tried upgrading my project to a newer Unity version before so that PlasticSCM could be used In-Editor but for whatever reason Unity would crash so I stayed with the older version (which should not matter since it has LTS)

    What should I do now? Besides abandoning the whole project.

    EDIT:

    I was fooling around with the Script Execution Order in Project Settings because my Spawn Manager would not always work after a scene reload (didn't work), BUT I added my Input Manager script and another additional script that has to do with inputs for testing and now the gamepad works in a build! For whatever reason my character is moving way too slowly but at least it's moving...
     
    Last edited: May 24, 2022