playMaker

Author Topic: Navigate menu with gamepad  (Read 3751 times)

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Navigate menu with gamepad
« on: April 26, 2022, 12:25:02 PM »
Hi guys !!

For the movements of the player and the appearance of the pause menu I have mapped the gamepad with the New Input System integrated in unity.

So when I press the start button on the pad, the pause menu opens, if I press start again the menu disappears. however I cannot navigate between the buttons in the pause menu.

how can I do ??

Thanks for your help !!! : D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Navigate menu with gamepad
« Reply #1 on: April 26, 2022, 08:48:19 PM »
Hi.
There should be a ui action Ui Set Selected Game Object.
You need to target one of buttons in your pause menu once you opened it.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Navigate menu with gamepad
« Reply #2 on: April 27, 2022, 06:26:32 AM »
hi !! thank you for the answer !!

Please can you be more specific ?? where i have to set the action ?? in the canvas or in the buttons ? any correlation with the "EventSystem" component ??

I'm using the integrated "New Input system" ...

thanks !!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Navigate menu with gamepad
« Reply #3 on: April 27, 2022, 01:04:33 PM »
Hi.
I think it should not matter which input system you use.

The issue is when you open the menu, nothing is selected yet.

So with that action it will select a Interactable object (like a button, but its not pressing it only "Highlight" it)

From there you should be able to navigate.

It does not matter where you set the action, as long as it triggers after you opened the menu

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Navigate menu with gamepad
« Reply #4 on: April 28, 2022, 04:54:26 AM »
hi !! and thank you for the explanation !

When i open the menu i have 4 buttons in horizontal position ...

| RESUME | OPTIONS | MAIN MENU | QUIT |

how can i navigate Between one button and another ?? and the selection have to be connected witch the controller D-Pad or analog stick ...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Navigate menu with gamepad
« Reply #5 on: April 28, 2022, 11:37:36 AM »
Hi.
After you opened the menu use the "Ui Set Selected" action and target the RESUME button.

Once its selected you should be able to navigate to the other buttons.

for the "New Input system" you might need to setup UI controls for it, but i never used the "New Input system".
I use the Rewired (asset) for all my projects.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Navigate menu with gamepad
« Reply #6 on: April 29, 2022, 06:09:04 AM »
hi !! thanks for your help !!

I've solved about the navigation , BUT , when i click on the controller button to open the pause menu, it works only one time ...

If i click on left mouse button, the controller button works again ... maybe there is a conflict between mouse and pad to manage the pause menu ...

anyway i'm workin' on it ... thank you ! :D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Navigate menu with gamepad
« Reply #7 on: April 29, 2022, 09:30:45 AM »
Hi.
Yeah mouse/gamepad combination does not work well.

if you press somewhere with your mouse on a empty space it selects nothing.

In our game Dark Light i set up a system to check if a button (or other interactable) was pressed, if not select back to the last selected button.
if so, store the value to the last selected variable.

if you have UI buttons or other interactable's outside the pause menu you need to set their interactable to false so you can not select those.

markettounity

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Navigate menu with gamepad
« Reply #8 on: April 29, 2022, 01:53:31 PM »
hi !!

Yes, i have other UI buttons on the screen, but they are not active ... there is an action to check wich device i'm using in that moment and disable the other(s) ??

Or in alternative, there is an action to move the mouse pointer and the left click by controller, i.e. with right stick controls the mouse pointer and use left trigger as left mouse button ?