GetJoyStickNames bug?

It seems that Input.GetJoyStickNames() is not properly grabbing the connected joystick names. When the debugger prints out the list it only shows “System.String[ ]”. I’m only testing this with a wireless xbox controller. Could it be possible that unity just doesn’t work with a wireless xbox controller? Ill look around in the house for a wired pc controller and see what happens.

Code:

    void Update()
    {
        gamepads = Input.GetJoystickNames();
        pad_count = gamepads.Length;
        if (gamepads.Length == 0)
        {
            Debug.Log("Nothing connected!");
        }
        else
        {
            Debug.Log("Connected controllers: " + pad_count.ToString() + "\r\n" + "Controllers: " + gamepads);
        }
    }

I was able to find 4 wired USB controllers. I only tried the “GGE909 PC Recoil Pad” and a “Saitek ST290 Pro”. Unity now shows that there are 2 connected controllers but will not print the name.

So no one has any idea whats going on? I would appreciate the help.

It’s because GetJoystickNames is a string array (string[ ]).

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour 
{
    void Awake()
    {
        foreach(string joystick in Input.GetJoystickNames())
            print (joystick);
    }
}

You could also do some GUI Labels for this

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour 
{
    void OnGUI()
    {
        foreach(string joystick in Input.GetJoystickNames())
        {
            GUILayout.Label(joystick);    
        }
    }
}