Question

I'm using Unity3D and I'm having issues with the keyboard when I 'build' the project.

When I run the game within the Unity Editor, the input works fine. However, when I build the project and test it, I have no directional input whatsoever. The mouse works fine, the game registers keystrokes (the Esc key works), but the player won't move.

I'm using Input.GetAxisRaw("Vertical") and Input.GetAxisRaw("Horizontal")

I researched the issue on the web, but I'm still stucked. The only solution I found (in various links) mentions a problem with DirectInput and states that you should remove the key "Input" from [HKEY_CURRENT_USER\Software\Unity\Player], in the Windows registry, but that doesn't seem to work for me.

Has anybody else fought this problem? Any working solutions? Am I doing the registry trick wrong?

Was it helpful?

Solution 2

I've figured out what was troubling me.

Input.GetAxisRaw("Vertical") and Input.GetAxisRaw("Horizontal") were fine the whole time. Somehow, there was some code in the script that in the Editor worked just fine, but when running as standalone gave me a calculation equal to 0 (it depends on the Delta Time, so I assume that the Delta Time when running compiled is much smaller than when running in the Unity Editor) and thus the character didn't move at all.

OTHER TIPS

You should check out Input Manager in Edit->Project Settings-> Input. Have you tried using GetAxis instead of GetAxisRaw? I also suggest using, eg: Input.GetKey(KeyCode.A) and etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top