Search Unity

UWP keyboard input

Discussion in 'Windows' started by amateurd, Sep 22, 2020.

  1. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    97
    For some reason keyboard input working on Win32 build fails on UWP. Apologies if I’m missing something obvious but can WASD controls work in UWP?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    They should work. How are you reading input?
     
  3. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    97
    Hi thanks, it's CrossPlatformInputManager.GetAxis("Vertical") but I also check for Input.GetKey(KeyCode.UpArrow)) in the Update() script.

    Both work on all platforms except UWP where they seem to be ignored.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Does Input.GetKey(KeyCode.W)) work? I'm very skeptical about Input.GetKey(KeyCode.UpArrow)) working when you press "W" since it's not supposed to.

    What is CrossPlatformInputManager?
     
  5. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    97
    I think CrossplatformInputManager is what was there before Input. Replaced it with Input.GetAxis etc and it all works.

    Nice to see it working but I can't see any advantages over Win32 yet. Thanks for your help.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did you try running on HoloLens or Xbox One yet? :D
     
  7. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    97
    Good answer!