Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Amazon Fire TV Remote Controller Mapping To Unity 3D

Discussion in 'Android' started by KevinCodes4Food, Apr 5, 2014.

  1. KevinCodes4Food

    KevinCodes4Food

    Joined:
    Dec 6, 2013
    Posts:
    61
    My Amazon Fire TV arrived last night, and I am setting up for Unity testing.

    Looks like the Fire TV remote is using standard Android media keycodes:

    • Select (D-Pad Center) KEYCODE_DPAD_CENTER
    • Play/Pause KEYCODE_MEDIA_PLAY_PAUSE
    • Rewind KEYCODE_MEDIA_REWIND
    • Fast Forward KEYCODE_MEDIA_FAST_FORWARD

    Is a mapping or plug-in available that routes Android media remote input to Unity KeyCodes or a similar interface?

    Also, any mechanisms from Unity to use the Fire TV game controllers? I've not implemented controllers in an Android title, so this is outside my area of knowledge. Perhaps they already work under standard Unity game controller mapping.

    Amazon Fire TV Remote Input: https://developer.amazon.com/sdk/asb/remote-input.html
    Amazon Game Controller Input: https://developer.amazon.com/sdk/asb/gamepad-input.html
     
  2. dnaney1978

    dnaney1978

    Joined:
    Nov 7, 2012
    Posts:
    3
    So far i have been able to get the inputs for Horizontal and Vertical to work. But for the life of me I cant seem to capture the DPAB center or what ever. DOes any one have any ideas?
     
  3. dnaney1978

    dnaney1978

    Joined:
    Nov 7, 2012
    Posts:
    3
  4. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
    I have been trying to get the remot working. I got most buttons working correctly. Anyone figure out the media buttons yet? They do not register to any KeyCode value using
    Code (csharp):
    1. foreach (KeyCode k in System.Enum.GetValues(typeof(KeyCode)))
    2.         {
    3.             if (Input.GetKeyDown(k))
    4.                 Debug.Log(k.ToString());
    5.         }
     
  5. KevinCodes4Food

    KevinCodes4Food

    Joined:
    Dec 6, 2013
    Posts:
    61
    From Amazon support:

    At the moment our FireTV Remote has the following mappings in Unity3D:

    FireTV Button Unity KeyCode
    Up Arrow KeyCode.UpArrow
    Down Arrow KeyCode.DownArrow
    Left Arrow KeyCode.LeftArrow
    Right Arrow KeyCode.DownArrow
    Center Button KeyCode.JoystickButton0
    Back button KeyCode.Escape
    Menu Button KeyCode.Menu

    The following buttons are not mapped in Unity and would need a plugin developed to accept input:
    Play/Pause
    Rewind
    Fast Forward

    The following are system-wide buttons and would not be mapped in 3rd party applications:
    Microphone
    Home
     
  6. Funtownarcade

    Funtownarcade

    Joined:
    Nov 6, 2012
    Posts:
    9
    Thanks for those mappings KevinCodes4Food, I got a test game working great. Do you know how to make it so that the Home button opens the Game Circle menu like the released games do?
     
  7. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
    If you figured this out let me know. When I try to map something to home it just exits out.
     
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    We've modified a game for the FireTV controls, but now realize that modifying the GUI so the player can tab from one GUI button to another is a bigger task. Are there any brilliantly simple methods for doing that with UnityGUI?
     
  9. dnaney1978

    dnaney1978

    Joined:
    Nov 7, 2012
    Posts:
    3
    Use this for reference... A headache to make $FireTVController.jpg
     
    Siberias likes this.
  10. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Has anyone figured out what the Fire TV's deviceModel name is, so we can target it with special inputs for the remote?
     
  11. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    Thanks a lot!! We were having a hard time with the triggers L2 and R2 on our end! thanks for sharing
     
  12. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    nvm
     
    Last edited: Apr 24, 2014
  13. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    got our game rejected for some few reasons. The game wasn't taking any inputs from the remote controller to interact in the game ( even if the damn game isn't meant to played with the remote controller )... Anyways, here I have a few concerns I tried the game and the inputs from the remote controller worked perfectly, then I tried to use the gamepad controller and it wouldn't work. Seems like once a controller is recognized by the game you can't use the other. How can we recognized which device is used and / or allow the remote and the controller to be used a the same time?
    Also since the game wasn't taking any inputs from the remote controller maybe they didn't even try the media buttons... though they worked on the game pad controller... We didn't have any state regarding media buttons for our game. thanks for giving the info if you know it.
    Cheers
     
  14. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    We haven't had any trouble with switching back and forth between the remote and the gamepad.

    The Media Buttons are working for you -- they'll pause/play music that's being played by another app, like Pandora? Those buttons are completely non-functional for us, and we can't figure out how to enable them. It seems like Unity is blocking their inputs somehow -- there's no way to accept their inputs either, so it's a catch-22. How did you get them to work?
     
  15. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    not sure if I can solve your problem as I'm not doing any of the development. I'm only the artist in the game. But I'm the one having the FIRE TV to test. We use the menu button for our pause menu. the home button works to get to the main fire tv screen and the back button works as well. once I get a hold f my dev, I'll ask him what he did.
    did you do anything special regarding the switching back and forth from remote to gamepad?
     
  16. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    We didn't do anything special for the remote and gamepad -- that, at least, is something that "just works." Odd that it doesn't for you.

    We've got the back/menu buttons working; it's the play/pause buttons below those on the remote which are the problem. They are disabled when our game is running, and Amazon rejects the app because of that.
     
  17. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    Whoops, sorry for the misunderstanding on my end. Well we're not using these at all. Our game got rejected because of some other stuff but not that. That's weird. Didn't know it was a requirement to have those inputs taken care of ...
     
  18. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
    For your issue switching between remote and controller, check how the controls are coded. If you specify something like "joystick0button0" instead of "joystickbutton0" it will only respond to the first controller (either controller or remote depending which was connected first).
     
  19. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
    They have updated their guidelines:

    3.5 Media Buttons

    Test: Press the Fast Forward, Play/Pause, and Rewind buttons.
    Expected Results: In media playback, the media buttons behave as expected. In non-media apps, the media buttons should not be used for some other function, as this may interfere with the system's ability to control media playing in the background. Note that If your app uses a framework such as Unity, you may ignore this requirement , as the ability to pass key events through to the system is not supported in those frameworks.
     
  20. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    Thanks for sharing all these info. Highly appreciated! :) We're currently looking into what's wrong with our inputs...
    Thanks a lot for your help. :)
     
  21. TechnOrganic

    TechnOrganic

    Joined:
    May 9, 2014
    Posts:
    6
    Great Thread, Having the same problems, got rejected! Has anyone figured out how to push a notification that you have a GamePad? Minion Rush did a good job of this.
     
  22. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    what about other chines android TV devices?
     
  23. ReticentCouch

    ReticentCouch

    Joined:
    Jan 29, 2013
    Posts:
    1
    lmbarns likes this.
  24. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Sorry for the necro but I'm not sure if it's due to a unity update or an amazon fire tv controller update but left trigger shows up for me now as the 14th axis (from 0 to -1) consistently now for me instead of the 13th axis. Might be useful if anyone else runs into this or notices a previously working game with left trigger not working anymore.