Search Unity

Can't select buttons with a controller

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by DustyShinigami, Jul 4, 2019.

  1. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    I have my controller set up, all the buttons are assigned in the Project Settings/Input, but pushing the analog stick and pressing buttons on my controller doesn't select anything in my pause menu etc. Even using the arrow keys on my keyboard doesn't select anything either; it only responds to my mouse.
     
  2. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    I've even tried just assigning the d-pad, but it doesn't register that either.
     
  3. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    Do movement keys and controller buttons need to be coded now instead of them working straight away?
     
  4. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    Looks like I've figured it out on my own (as usual). But I'll post what the problem was for my own future reference or if anyone else has a similar issue.

    I figured that because Horizontal and Vertical were already assigned in the Project Settings > Input, that they would work straight away. Turns out I was supposed to drop the button I wanted selected first in the First Selected box under the EventSystem.
     
    EddieMonsi likes this.
  5. EddieMonsi

    EddieMonsi

    Joined:
    May 24, 2019
    Posts:
    5
    Have you figured out if there's a way to have it continuously use the arrow keys when transitioning menus?

    For example, I have a main menu that has a option button. When I press on the option button it disables the main menu and shows the options menu. But now I'm back to square one where I can't select anything with my arrow keys.
     
  6. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    I haven't implemented option menus before, sorry. I've only done a main menu and a pause menu. I'd suggest following Brackey's tutorial:
     
  7. EddieMonsi

    EddieMonsi

    Joined:
    May 24, 2019
    Posts:
    5
    I actually went through all his menu content. He never talks about this issue though :/
     
  8. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    Hmm... Have you tried adding the first button to be selected via the Event System?
     
  9. EddieMonsi

    EddieMonsi

    Joined:
    May 24, 2019
    Posts:
    5
    Yes, thanks to your comment, I was able to find out that problem. But it deactivates my controller input so I can't select my buttons in the options. It works with my mouse though, so I know my buttons are working. The way I set up my menu is very similar to Brackey's tutorial on menus.
     
  10. DustyShinigami

    DustyShinigami

    Joined:
    Jan 5, 2018
    Posts:
    509
    I'll have to see about setting up an options menu for my own project and see if I come across the same problem. At the moment though, I'm busy trying to fix some other bugs. :)