Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Xbox Controller For Windows Metro

Discussion in 'Editor & General Support' started by dhivakar, May 4, 2015.

  1. dhivakar

    dhivakar

    Joined:
    Jun 21, 2013
    Posts:
    30
    Hi, I need to integrate Controller Inputs in my game. The Controllers works fine in the editor, but when i build the Metro app and run it, none of the Inputs are detected. I am checking the Controllers connected using the "Input.GetJoystickNames ().Length > 0" and it returns true when the controller is connected. But no inputs.

    Unity Version : 4.6.1p4
    Using UnityPro Licence.
     
  2. RalphOcampo

    RalphOcampo

    Joined:
    Mar 13, 2015
    Posts:
    9
    Hello dhivakar,

    I have a Metro Universal game in the Windows Store that has Xbox 360 controller support and it does not have the problem you are describing. I also use xboxControllerConnectedState = Input.GetJoystickNames().Length > 0; to detect the controller.

    I am using the free version of Unity 3d 4.6.3f1 and Visual Studio Community.

    I am using a Xbox 360 wired controller. I have implemented code so that when I insert the cable into the USB port Xbox controller button graphics pop up on the screen indicating what button causes which game object to be activated.

    You can test with my game if you like. It is completely free with no ads. It is a simple card game and is called "21 Silos". By the way, after you win a hand you are awarded a rocket which you can then use to shoot down UFOs. After you start the game press the "Start" button on the controller (Located just below and to the right of the big Xbox button. Then use the A, B, X, and Y buttons to place a card in a column.

    While confirming the Xbox controller also still works with the release build in the store, I noticed that I do not display the Xbox controller button graphics while in rocket game mode. I will be fixing that this week end.

    Regards,
    Ralph
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    How are you getting input from the joystick? Unity has a nasty habit of assigning joysticks to arbitrary Id's in Windows. So you may be trying to get input from Joystick 1 when Unity really assigned it to Joystick 3. If you're only supporting 1 player, you can set your input manager settings to get input from all joysticks and it will cover over this issue.

    However, if you want a much more comprehensive input solution, I suggest you check out Rewired, an advanced input system I've developed that makes working with joysticks in Unity a much easier experience, among many more great features. You can get a free trial on the website.
     
  4. dhivakar

    dhivakar

    Joined:
    Jun 21, 2013
    Posts:
    30
    Hi guavaman,

    Thanks for ur comments. I fixed the Issue. The problem is in the implementation.
     
  5. dhivakar

    dhivakar

    Joined:
    Jun 21, 2013
    Posts:
    30
    Thanks
    RalphOcampo

    We fixed the issue since its a mistake from our implementation.