How to Control Your Menu with Keyboard/Gamepad | Unity Tutorial

preview_player
Показать описание

If you've ever made a menu in your game, you'll know that as soon as you implement gamepad controls things don't work quite as easily as they do with the mouse. This video will help you with that!

In this easy Unity tutorial, I'll show you how to:
- Setup Controls with the Input system (cause using the old Inputs... is gross)
- Setup a handy Input Manager to detect Input with multiple control schemes.
- Create 2 simple menus we can swap between.
- How to set which button is selected first by default when you open a menu (which is the secret sauce to actually setting up gamepad/keyboard navigation in your menu.)
- How to explicitly control button/UI element navigation in your menu

Link to Download the FREE 2D Asset Pack seen in this tutorial:
---
---

Contents of This Video: ------------------------------------------

00:00 - Intro
00:17 - Setting Up a Menu with Buttons
02:37 - Setup Input System Keyboard + Gamepad Controls
03:28 - Creating an InputManager to Detect Input with Code
04:10 - Creating a MenuManager to handle Menu Button Actions and Pausing the Game
05:51 - How to Add an Event to a UI Button
07:08 - How to Add Keyboard and Gamepad navigation to your menu
08:23 - How to change menu navigation controls
08:40 - How to change button navigation options (press left to go to THIS button)

Who We Are-------------------------------------

If you're new to our channel, we're Brandon & Nikki from Sasquatch B Studios. We sold our house to start our game studio, and work full time on building our business and making our game, Veil of Maia.

Wishlist our Games:

Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!

Follow us on Twitter for regular updates!

#unitytutorial #unity2d #unity3d
Рекомендации по теме
Комментарии
Автор

i love these tutorial vids, at least one of them will always be some random area i didnt give enough attention
thanks for these dude, good luck on the game

NotNahtan
Автор

Thank you for this, super quick and helpful!

inunekonanita
Автор

Awesome tutorial man, the notification came right when I was going to start creating the pause menu for my game

brunotorrao
Автор

Awesome Tutorial! Thank you sooo much!

bubug
Автор

Dude you explain so well, and your code is just beutiful hahahaha

MegaCuerdas
Автор

Great video ! Thanks !
I'm having a question though. I'm using Rewired, and I'd like to be able to navigate through my buttons not only with the joystick but with the D-Pad too. How can I do that ?

Benji
Автор

Would love to see a follow up video on key rebinding with the new input system.

tomkc
Автор

Great tutorial, had a question. With that menu system in place, how would you code it so that by pressing lets say the start button on the gamepad it will trigger the pause menu?

ordep
Автор

Thanks for that great tutorial !
At the moment, to click on a button with the Gamepad I need to press the south button.
But I would like to change that to the east button.
How do I do that ?

MrJent
Автор

when the controller highlighting the button if i bring mouse to another button its also highlighted how to fix this

harimrlocal
Автор

the new input system use UnityEvents also... more expensive but more straigh foward... are you using pure Csharp class to generat the Action ? and the AtionMap?I think the new intpu system can be anighter for UI, without no planning.

risingforce
Автор

my code is exactly like the one at 4:13, but I keep getting this compiler error:
"Assets\Scripts\Managers\GameInput.cs(73, 39): error CS0428: Cannot convert method group 'WasReleasedThisFrame' to non-delegate type 'bool'. Did you intend to invoke the method?"

EDIT: I fixed it, turns out I was missing the brackets in 'WasReleasedThisFrame()', lol

guricomfotodeanime
Автор

Getting controller input just fine and being able to open the menu on controller, keyboard menu opening is not working at all for some reason, works perfect on controller and not at all on keyboard, any advice?

stopmotionman
Автор

Something about the InputManager wasn't working on my end. For one, it didn't seem to recognize the function WasPressedThisFrame(). When I tried alternatives like using .triggered, it still didn't seem to pick up on the input. I'm guessing either my input manager package is configured incorrectly or I configured the particular input wrong (it was just the E key on the keyboard)

BADGRAPHIX
Автор

I am happy cuz I have a working cool menu now, but I am also sad because he coded like 12 different things that I have no clue on. Felt like a mf'ing scribe instead of developer after this vid

kucukgolem
Автор

I gotta learn Unity. I'm currently making a game in SpriteKit and there's nothing that I know of built in like this. My menu system is completely custom made.

lost
Автор

This is obviously a great tutorial but -- If we are being honest, Unity love to pretend like you aren't creating a video game by requiring this much setup to literally interact with a single menu.

TheRunthis
Автор

Thank you so much. I watched this in 18.June.2024 and you can still use it.

BBFTW
welcome to shbcf.ru