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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

GameCube controllers support

Discussion in 'Input System' started by print_helloworld, Jun 3, 2020.

  1. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    So I had access to game cube controllers a few months ago, and figured I'd implement HID classes for those godly controllers, here it is: github repo

    Installation is pretty straight forward, add it as a git package from UPM, and yeah. It gets registered as a GameCubeController type, which inherits from Gamepad. It will also reimplement some of the properties from the Gamepad class and return null on those on purpose (since those controls dont exist, or no close relative is available).

    The controls are documented in the readme file, enjoy.
     
    GuitarBro and TabuuForteAkugun like this.
  2. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    Hey @Lelepoop , I'm trying to make this work but nothing is reacting when I press my controllers. I have the official adapter, and it's working on Dolphin with the Zadig installer.

    I don't think I'm using it the correct way, I'm trying the input action window to map the controls...

    Is it normal if my gc controllers does not appear in the Input Debug?

    Maybe you can help? Have a nice day.
     
  3. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    If the device does not appear in the Input Debug window then no, its not normal. In my case, with the zadig drivers the adapter should at least show up as an unrecognized device, can you show me the list? The adapter that I used specifically is the mayflash 4 controller one.
     
  4. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    Okay, it may be because I'm using the official adapter
    upload_2020-11-16_18-19-49.png
     
  5. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    Hmm I see, it might be mapped as the XInput controller there (unless you have a generic controller or steering wheel plugged in). If thats the case do you mind sharing the name, layout, type, interface, flags and keyboard layout? I might be able to find a way to override it so that the controller gets mapped as a GameCube Controller type instead of an XInput one.
     
  6. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    Nah, the XInput you see is a XBox Series controller plugged in to my computer...
     
  7. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    The adapter may be the 4 "Logitech USB Keyboard (HID)"?
     
  8. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    Okay, I reinstalled everything, and I'm still stuck. Gamecube Controller is not showing up in Unity, and I'm trying to understand your code: there's a vendorId, maybe it's not the same since I'm not using the same adapter?
     
  9. Mat_Mox

    Mat_Mox

    Joined:
    Jun 10, 2018
    Posts:
    7
    I have come to the conclusion that the official adapter needs a special wrapper. I don't know how to do that, but it looks like a fun challenge. I need to find how to access the WUP-028 device from the new Input System. If you have any information, I take it :)

    Thanks a lot for your reply.
     
  10. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    Well, if the device doesnt even show up on the list, you wouldnt be able to check against the vendor ID in the first place, the mayflash and the zadig drivers work because zadig overwrites the existing drivers with their own to where windows attempted to install.
     
  11. TabuuForteAkugun

    TabuuForteAkugun

    Joined:
    Sep 28, 2015
    Posts:
    56
    Ooh, I'm loving the idea of this!!

    I would like to implement this as I am making a Super Smash Bros. fan game in Unity and have always wanted to support these controllers!

    I can't wait to try. :)
     
    print_helloworld likes this.
  12. T00nbink

    T00nbink

    Joined:
    Jun 21, 2017
    Posts:
    5
    I've been trying to get this to work but there seems to be an issue with recognizing the GameCube Controller for me. I get this error. I tried to change some things in GameCubeController.cs but it didn't seem to solve anything as far as I know so I'm not sure what to do now, if you have any idea what might be going wrong I would love to hear from you.

    upload_2021-10-17_21-23-25.png

    Here is the link to the full error (They are all the same, I assume because of the nature of the Mayflash adapter simulating 4 controllers at once) https://pastebin.com/ndVH9q0Y

    EDIT: My adapter didn't show up in the Input Debug Window at first but for unexplained reasons it did after restarting it a couple of times as an unrecognized device.

    EDIT 2: It can't find the mayflash adapter anymore, it might have found it when I turned PC mode on? In any case I have no issue when trying to use my gamecube controller with other programs/games like Dolphin or Nickelodeon All-Star Brawl. So I'm not sure what the issue is.

    Here is the device description of the mayflash device listed in the image above:

    "interface": "HID",
    "type": "",
    "product": "MAYFLASH GameCube Controller Adapter",
    "serial": "",
    "version": "256",
    "manufacturer": "mayflash limited",
    "capabilities": "{\"vendorId\":121,\"productId\":6211,\"usage\":4,\"usagePage\":1,\"inputReportSize\":10,\"outputReportSize\":3,\"featureReportSize\":0}"
     
    Last edited: Oct 17, 2021
  13. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    It should be able to create the individual controls juts fine (as it worked back then), from the error logs in the first screenshot it looks like the type of control should change to become an AxisControl. Im actually not sure why the controls are "supposed" to be a ButtonControl because back then this was never an error. I also dont have these controllers and the adapter anymore, so sadly I cant test and fix it atm.
     
  14. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    @T00nbink

    I bought a controller and the adapter, and I'll be getting them on the 10th (no amazon prime on the mayflash rip). So I'll be able to take a look at the current issues. I also have an issue on Github about this too.

    I'll see what I can do when I get the hardware in.
     
  15. T00nbink

    T00nbink

    Joined:
    Jun 21, 2017
    Posts:
    5
    I'm still unsure if this is something I did wrong but if you could take a look at it that would be great. Thank you for replying and going to so much trouble to help me.
     
  16. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    I dont know how this issue occurs, the version that I tested the GC controller on didnt have this issue (1.0.0), and I dont have the controller nor the adapter atm so I cant test and fix this issue. I linked the github issue because it mentions that im getting one and the adapter to verify it and fix any extra bugs. What version of the input system is this btw?
     
  17. T00nbink

    T00nbink

    Joined:
    Jun 21, 2017
    Posts:
    5
    Version 1.0.2, the latest one I assume.
     
  18. Bangurah

    Bangurah

    Joined:
    Sep 22, 2018
    Posts:
    1
    Hello
    Hello, I'm having trouble trying to config my GameCube controller for the new input system. But it looks like whenever I connect the adapter, it shows an error in the image below. I'm using a pdobq adapter and I don't know if it has something to do with my adapter or how I installed it, since I installed the package from disk. It seems my computer is picking it up as a GameCube controller adapter, but not the unity version.

    Screenshot (197).png