Controller Input with Unity
You can use the Unity development tools to create apps and games for Amazon Fire TV devices as you would any Android device.
Although we do not provide a Unity plugin for Fire TV development, there are packages in the Unity Asset Store to enable game controller support. In particular, InControl by Gallant Games is one with which our developers have had great success. InControl is a cross-platform input manager for Unity3D that standardizes control mappings for a variety of common controllers.
You can also use the Unity input manager to configure controller input for your game. Use the tables below to map the buttons on the Amazon Fire TV remotes and game controllers with the Unity input manager buttons and axes.
Note: The input references in this document apply to Unity 4.3.x and higher, but are subject to change with future Unity releases.
Remote Control Input
Use these values in Unity to map the buttons on both the Amazon Fire TV Remote and Voice Remote. See KeyCode for more details about Unity KeyCode values.
The remote for Fire TV Edition has some additional buttons — volume up/down, power, Netflix, Amazon Music, and Amazon Prime. However, these buttons can't be mapped to events in third-party apps, so the buttons shown in the above Fire TV remote are effectively the same available buttons for Fire TV Edition's remote, even if the remotes look a bit different.
|Button||Unity Input Manager Value||Unity KeyCode Value|
|Home||one (system event)||none (system event)|
|Back||none (not supported)|
|Menu||none (not supported)|
|Microphone (Search)||none (system event)||none (system event)|
|Select (D-Pad Center)||joystick button 0|
|Left (D-Pad)||5th Axis|
|Right (D-Pad)||5th Axis|
|Up (D-Pad)||6th Axis|
|Down (D-Pad)||6th Axis|
|Play/Pause||none (not supported)||none (not supported)|
|Rewind||none (not supported)||none (not supported)|
|Fast Forward||none (not supported)||none (not supported)|
Game Controller Input
Use these values in Unity to map the buttons on the Amazon Fire Game Controller. See KeyCode for more details about Unity KeyCode values.
The current version of the Fire TV Game Controller has these buttons:
The previous version of the Game Controller has these buttons:
|Game Controller Button||Unity Input Manager Value||Unity KeyCode Value|
|Home||none (system event)||none (system event)|
|Back||none (system event)|
|Menu||none (system event)|
|GameCircle||none (system event)||none (system event)|
|A||joystick button 0|
|B||joystick button 1|
|X||joystick button 2|
|Y||joystick button 3|
|Left (D-Pad)||5th Axis||none|
|Right (D-Pad)||5th Axis||none|
|Up (D-Pad)||6th Axis||none|
|Down (D-Pad)||6th Axis||none|
|Left Stick (Left/Right)||X Axis 1st Axis||none|
|Left Stick (Up/Down)||Y Axis 2nd Axis||none|
|Left Stick Press||joystick button 8|
|Right Stick (Left/Right)||3rd Axis||none|
|Right Stick (Up/Down)||4th Axis||none|
|Right Stick Press||joystick button 9|
|Play/Pause (1st version only)||none (not supported)||none (not supported)|
|Rewind (1st version only)||none (not supported)||none (not supported)|
|Fast Forward (1st version only)||none (not supported)||none (not supported)|
|Left Trigger (L2)||13th Axis||none|
|Left Shoulder (L1)||joystick button 4|
|Right Trigger (R2)||12th Axis||none|
|Right Shoulder (R1)||joystick button 5|
Controller names are available in Unity with the method. Use these values for each controller:
- Voice Remote:
- Game controller:
For those of you who like to do your programing on a Mac lapTop, Unity may not be the best solution. The Unity Software uses all the standard Key clicks that you are used to when using mac, or LapTops, but several (most) of the developers of the assets you will run into, seem to either not take Mac into account, or restrict it on purpose (not sure why they would do this).
Mac uses a single button mouse. PC uses 2-8 button mouse, with most using 3. Mac adapts to this with Ctrl-Click. Ctrl-Click serves the same purpose as Right-Click on a PC mouse. 99.99% of software ported to Mac, uses this solution.
I have downloaded several (over 10) assets from the Unity Asset Store, and had most fail on my lapTop (MacBook Pro), due to non-responsive clicks. The assets allow me to Click on something, but when it requires a Right-Click, the standard Ctrl-Click (you would use on Mac), is not accepted.
To get around this, you need to mess with the Input Receiver Scripts that come with the asset. There are several on the assets store, and (so far) not one is just drag-and-drop. All require you to edit the script so that it will work for whatever asset you want to use. This gets VERY frustrating when downloading multiple assets, to figure out which works best for your needs. When just fighting the Click, I never get to see the full functionality of what their asset can do.
The simple work-around (not so simple), is to use a 2+ button USB mouse. But… this kills the idea of working on a lapTop. You now need to carry around a mouse, and have a surface you can use it on.
In Unity's top menu: Edit->Project Settings->Input
In the input Manager you can change settings for each “action”. There is a Positive Button and an Alt Positive button. Both of these can be use independently. "Fire 1” Positive Button is set to "left ctrl”. "Fire 1” Alt Positive Button is set to “mouse 0” <—— left mouse click..... So if you hit the left control key OR use the trackPad/Left-Mouse-Button, this will activate Fire 1. I can not find a way to have multiple buttons in this list. For instance, I can not set "Fire 1” Positive Button to "left ctrl + mouse 0” Can not find any documentation on this.
…anyway … In whatever input script you have for your game, find a line that looks like this:
And change it to:
This will make it use whatever button you assigned in the inputManager calls the action.
In that same script, replace the line of code
if (Input.GetKey("left ctrl") && Input.GetMouseButtonDown(0))
This will make it so you must use the Left Control Click AND the trackPad/Left-Mouse-Button. This will make it so every mac user can continue to use the asset as normal, where Ctrl-click is the same a s Right-MouseButton click.
If you want to get fancy, and tend to use Mac and PC for doing your programing…
if (Input.GetKey("left ctrl") && Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
The || is the same as an OR statement.
Of course, later, when you port over to your mobile device, you’ll have to create those inputs, but that will be later, after you tested your assets, and know what you want your game to do.
Hope this helps.
If anyone knows how to put multiple key combinations in the input manager, please let me know.
Some other good resources for this:
button values are 0 for left button, 1 for right button, 2 for the middle button. http://docs.unity3d.com/ScriptReference/Input.GetMouseButton.html