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

How To: Amazon Fire Stick

Discussion in 'Android' started by mholmes, Nov 6, 2020.

  1. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    414
    I do not see a lot of Fire Stick, so I wanted to share a quick video and steps on how to support the Fire Stick:

    Video:


    Steps:
    1. Go to your Build Settings
    2. Visit https://developer.amazon.com/docs/fire-tv/controller-input-with-unity.html
    Input Settings:
    -Go to Input in Unity
    -Find Horizontal
    -Make sure its named Horizontal
    -Negative Button = left
    -Positive Button = right
    -Alt Negative Button = a
    -Alt Positive Button = d
    -Gravity = 3
    -Dead = 0.001
    -Sensitivity = 3
    -Type = Joystick Axis (I this can be set to keyboard mouse but dont quote me on it)
    -Axis = 5th Axis (Joystick)
    -Joy Num = Get motion from all joysticks​
    Refer to the Amazon Document Link listed above if this setup dos not work
    3. Code Setup
    Code (CSharp):
    1. private void Update()
    2.     {
    3.         //direction = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")) * Time.deltaTime;
    4.  
    5.         foreach (KeyCode kcode in Enum.GetValues(typeof(KeyCode)))
    6.         {
    7.             //Keypress Method
    8.             if (Input.GetKeyDown(kcode))
    9.             {
    10.                 switch (kcode)
    11.                 {
    12.                     case KeyCode.Joystick1Button0:
    13.                         Click_Bug();
    14.                         break;
    15.                     case KeyCode.LeftArrow:
    16.                         Click_Random_Bug();
    17.                         break;
    18.                     case KeyCode.RightArrow:
    19.                         Click_Random_Bug();
    20.                         break;
    21.                     case KeyCode.Escape:
    22.                         Click_Home();
    23.                         break;
    24.                     case KeyCode.Menu:
    25.                         Click_Home();
    26.                         break;
    27.                 }
    28.             }
    29.         }
    30.     }
    My Code snippet is for a simple game I made. Use it as a reference but not a literal guide.

    4. In your Build Settings Select "Player"
    -Other Settings
    -Choose API level 22 as minim
    -Check Android TV Comparability
    -Works with D Pad​
    5. Other Documentation/References:
    -https://developer.amazon.com/docs/app-submission/publish-app-upload-apk-files.html#adjust_device_support​


    I hope this helps everyone who wants to build for Fire Stick. If I missed a step or something is wrong please post a reply.

     
    wagenheimer likes this.
  2. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    414
    Just wanted to share with everyone. I got my app approved finally and was able to test. Yes this config seems to work for Fire Stick. I hope to see everyone's apps on the fire stick soon.
     
  3. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
    Thanks for the tutorial! I will test it right now with my game that now has controller support!
     
  4. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
    I have to manually set the devices on Amazon Fire TV and Automotive. Did this happen to you too?

    upload_2021-9-22_22-5-0.png

    Well I just sent it for approval. Let's see what happens! =)
     
  5. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
  6. beletv

    beletv

    Joined:
    Sep 24, 2021
    Posts:
    1
    Ótimo artigo! Fazia tempo que procurava algo tão esclarecedor. O Amazon Fire Stick é realmente show!
     
  7. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
    Just a tip, ReWired has great support for the Fire Stick Control Remote and GamePads.
     
    derkoi likes this.