Android TV controller

Hello,

I have got a problem with distribution on the Play Store for Android TV. I got rejected every time I tried, because my game didn’t met requirements for the controller. Email from google:

Your game is inaccessible with a standard Android game controller. We are unable to navigate left or right within the menus of your game. Please make sure all menus and options are fully functional using the game controller.

Ok, then so I doesn’t work with their controller, but what I did wrong? I wasn’t able to find how to configure controller for Official Android TV, so I used this from amazon. Anyway I see that this is not the same and I can’t pass through google.

Here is my question how to configurate android inputs to pass throught google veryfication?!

BTW. Here is my game → 2, you can check it out on your Android TV and tell me what doesn’t work…

I just figured this out a couple hours ago. In the Event System, there’s a ‘Standalone Input Module’ script. At the bottom of that script in the inspector there’s a bool option (check box) called ‘Allow Activation on Mobile’… Checking this box allowed menu navigation to work for me. Also I think some of the input settings are a little different between the XBox gamepad and the Android TV gamepad. So check this page out: NVIDIA GameWorks Documentation and make sure your input manager is set up correctly. Hope this help, good luck!

Edit: It appears that enabling ‘Allow Activation On Mobile’ screws up touch input. Trying to find a solution now.

Edit 2: Alright! So it looks like the thing to do is to leave the ‘Allow Activation On Mobile’ unchecked/disabled and then in the Start function of a script check for gamepad presence. If a game pad is present, then enable ‘Allow Activation On Mobile’. You can check for a gamepad with Input.GetJoystickNames(). To access the event system, you’ll need to include using UnityEngine.EventSystems. In my game I have a game manager that keeps a record if a gamepad is present so here’s my script:

using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;

public class DetectGamepad : MonoBehaviour
{
	void Start()
	{
		if (Input.GetJoystickNames().Length > 0)
		{
			GetComponent<StandaloneInputModule>().allowActivationOnMobileDevice = true;
			GameObject.FindGameObjectWithTag("Game Manager").GetComponent<ManagerUsingGamepad>().SetUsingGamepad(true);
		}
    }
}

Also, I’m assuming your game is aiming to receive both touch and gamepad input. So when you enable your menu, you’ll need to set one of the menu buttons to ‘Selected’. Otherwise menu navigation won’t work since there’s not start point to navigate from. Here’s another simple script I added to the start button of my main menu:

using UnityEngine;
using UnityEngine.UI;

public class GamepadMainMenu : MonoBehaviour
{
	public Button startGamebtn;

	void Start()
	{
		if (GameObject.FindGameObjectWithTag("Game Manager").GetComponent<ManagerUsingGamepad>().GetUsingGamepad())
		{
			startGamebtn.Select();
		}
	}
}

Hope this helps! Good luck and happy programming :slight_smile: