Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Question ChromeOS input questions

Discussion in 'Chrome OS' started by acmshar, Nov 29, 2022.

  1. acmshar

    acmshar

    Joined:
    May 4, 2010
    Posts:
    29
    I have successfully built my game for ChromeOS, but I'm having issues with input. The following code works on all other platforms when using the arrow keys or 'w'/'s'.

    Code (CSharp):
    1. movement = Input.GetAxis("Vertical") * target.transform.forward;
    Note that this code is set up using the old input system. I tried enabling and disabling the 'ChromeOS input emulation' toggle.

    The following code works on all platforms including ChromeOS:

    Code (CSharp):
    1.             if(( Input.GetKey(KeyCode.A)) || ( Input.GetKey(KeyCode.LeftArrow))) {
    2.                 //code to move camera
    3.             }
    So I see a few options for fixing this:
    1. Upgrade to the new input system. I'd like to do this at some point, but it's likely going to take some time, so I'd like an easier solution in the mean time if one is available.
    2. Update the first bit of code, maybe with a platform define to use keycodes rather than getAxis(). Our controls aren't well tuned for gamepads so the getAxis call isn't as important as in some other game types.

    Questions:
    1. Am I missing any easy ways to get this working on ChromeOS? Should getAxis work?
    2. Is there a platform define for ChromeOS specifically, or just UNITY_ANDROID?
    3. I don't see build targets specific to ChromeOS. In order to build for ChromeOS from a script, would I have to set the build target to Android, and have the build and player settings set correctly, or are there options to set those in the script?

    Thanks.
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    1. I think it should work just fine, if not - could you submit a bug report? Thank you
    2. There's no define, but there's a runtime check - https://docs.unity3d.com/ScriptReference/Android.AndroidDevice.html
    3. ChromeOS is essentially Android that's why there's no separation here.
     
  3. acmshar

    acmshar

    Joined:
    May 4, 2010
    Posts:
    29
    Tomas, Thanks for the detailed response. That GetAxis call is definitely not working for me. I'll try to put together a bug report for that.