1
\$\begingroup\$

I've built a game in Unity 2017.1.1f1 for the web. I have inputs to allow user to play with either the keyboard or a gamepad (in my case, a Gamecube USB). So far as I can tell, all controls work fine EXCEPT for my right (C) thumbstick. When I use the keyboard inputs which are an alternate for the C thumbstick, they work, and the C thumbstick works in the editor. These facts seem to rule out that there's any problem with my input settings or with my code or with my gamepad. Any ideas of what I can do to fix this? I'm not even sure where I would begin troubleshooting.

UPDATE: I built a UI to output a float for all axes. In the editor, I got a response for this thumbstick. On the web, the vertical axis for this thumbstick changed nothing.

\$\endgroup\$
10
  • \$\begingroup\$ Are you using the old Input, or the new "Input System"? I guess that the editor and browser map the controller axis differently somehow. \$\endgroup\$ Jun 17, 2021 at 11:55
  • \$\begingroup\$ I'm working in Unity 2017.1.1f1. I'm guessing this is the old input and not the new system. I wasn't aware that there is a new system. Could you give more info? \$\endgroup\$
    – Truth
    Jun 17, 2021 at 12:05
  • 2
    \$\begingroup\$ Is there a reason why you are using such an outdated version of Unity? Perhaps this is a problem which is fixed in a more recent release. Even if you are afraid of well-hidden bugs showing up due to upgrading, you might still want to upgrade to the most recent LTS release of the 2017 major version (which should be the LTS Release 2017.4.40f1). Although something as major as that might require to even upgrade to a different major version. \$\endgroup\$
    – Philipp
    Jun 17, 2021 at 12:43
  • 2
    \$\begingroup\$ My best guess is that the C thumbstick maps to different axes in the browser API that Unity has to communicate through in WebGL. Have you tried making a project with inputs mapped to every axis, displaying the value of those inputs via some UI, so you can test to see which if any of those values change when you move the thumbstick in WebGL? \$\endgroup\$
    – DMGregory
    Jun 17, 2021 at 13:17
  • 1
    \$\begingroup\$ @Truth Changing horses midstream can be a wise decison when you find out that your horse has a disease (bug or missing feature) which means it might not make the trip and a healthier horse is available. I have a couple projects which went through multiple Unity upgrades and had no problems at all or only problems which were easy to fix. You might still want to make sure that everything is under version control, though, so you can easily revert if you encounter some upgrade problems after all. \$\endgroup\$
    – Philipp
    Jun 17, 2021 at 14:57

1 Answer 1

1
\$\begingroup\$

Well, I was unable to reproduce the problem using Unity 2020.3.11f1 and my own gamepad (Cheap XBox 360 compatible gamepad by Speedlink).

I used the Input Manager to create 7 axis inputs and mapped them to the Joystick axis X, Y, 3, 4, 5, 6 and 7 "from all Joysticks". I then created a script to visualize those 7 axis' on the canvas.

The result behaves the same way for me in both the editor and the WebGL build, the latter both in Firefox and in Edge. I uploaded the result to itch.io so you can check it yourself.

Those axis map to my gamepad as follows:

  1. Left Thumbstick Horizontal
  2. Left Thumbstick Vertical
  3. Triggers
  4. Right Thumbstick Horizontal
  5. Right Thumbstick Vertical
  6. D-Pad Horizontal
  7. D-Pad Vertical

Note that not all gamepads will map the same way. This is one of many input device compatibility problems the new Input System available in Unity 2019+ solves. When you don't want to migrate to the new input system, then the best workaround is to let the player configure their input axis` themselves.

When it does work as well for you as it works for me, then I recommend you to update your project to a more recent version of Unity. I can't tell you how recent you have to go, so when you don't want to go all the way to 2020, then you have to find the minimum required version yourself using trial and error.

\$\endgroup\$
3
  • \$\begingroup\$ Your demo worked for me on the first try. I've upgraded and relaunched my project. Now I'm having trouble getting it to run in the browser at all. I'm getting "invalid unexpected token" error out of one of the build scripts. Changing horses mid-stream... \$\endgroup\$
    – Truth
    Jun 22, 2021 at 2:40
  • \$\begingroup\$ "Unable to parse Build/finalbuild.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug." I have no clue what to do with that. \$\endgroup\$
    – Truth
    Jun 22, 2021 at 2:56
  • \$\begingroup\$ @Truth I don't think we can solve this problem in a comment discussion. Please post this as a new question. \$\endgroup\$
    – Philipp
    Jun 22, 2021 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .