Using Menus with A Controller/Keyboard in Unity

  Рет қаралды 78,401

gamesplusjames

gamesplusjames

Күн бұрын

Пікірлер: 145
@brandonwaite4073
@brandonwaite4073 4 жыл бұрын
for anyone who is curious to know, I can confirm that this DOES work with Unity's new INPUT system. I had issues getting it to work with a controller, until I changed my "Active Input Handling" in 'Player' in 'Project Settings' from BOTH to NEW. After this, select your 'Event Handler' and let Unity upgrade it. Works like a charm after this.
@szkokee
@szkokee 3 жыл бұрын
I have switched because it didnt work and im getting an error. "You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings." Then i choosed the options "Both" that made the error go away but all this menu setup still doesnt work.
@kristophia7310
@kristophia7310 3 жыл бұрын
@@szkokee go to event system and update it
@vladstefanvulpe6186
@vladstefanvulpe6186 3 жыл бұрын
@@kristophia7310 sorry, how do you update it? i can't figure it out
@kristophia7310
@kristophia7310 3 жыл бұрын
@@vladstefanvulpe6186 the input system is having a problem that you still want the old one you can use bolth if there is no bugs
@simonvutov7575
@simonvutov7575 3 жыл бұрын
Thanks this works very well!! (:
@wmorais1976
@wmorais1976 4 жыл бұрын
The best explanation I've seen about UI navigation!
@MesaTheAalfa
@MesaTheAalfa 3 жыл бұрын
agree
@swornimpangeni1286
@swornimpangeni1286 2 күн бұрын
Thank you so much. You're a true savior. Searched the whole you tube, nobody explained it better than you.
@fableisticstudio6861
@fableisticstudio6861 4 жыл бұрын
Excellent tutorial. There is plenty of information out there about the navigation and "First Selected" in the event system. However, the the scripting aspect is the real gem here. This solved all of the issues I was having with menu navigation.
@mcalageorge7366
@mcalageorge7366 4 жыл бұрын
Bless you man, I've been looking for this for so long. You're awesome
@patrickmorter9097
@patrickmorter9097 4 жыл бұрын
I've never looked into keyboard menus until today, due to being under the impression that they were going to be a lot more complicated than this (due to a previous video I had seen). Watched this video and then implemented a multi-panel in minutes. Nice one!
@Destructivepurpose
@Destructivepurpose 2 жыл бұрын
Exactly what I was trying to figure out. Hats off to you, sir!
@Hymnal27
@Hymnal27 3 жыл бұрын
I really like how you explored the problem before jumping into solutions - thanks for the video!
@pillemarisken
@pillemarisken 2 жыл бұрын
Thanks for the tutorial James! If anyone's having issues with their buttons not animating when the game is paused, go to each of your button's Animator and make sure that the Update mode is set to Unscaled Time instead of Normal. 🙂
@AmalieKae
@AmalieKae 4 жыл бұрын
This was SO helpful, you have no idea! Thank you so much!
@TegridyMadeGames
@TegridyMadeGames 2 жыл бұрын
Such a simple feature, thanks for explaining it.
@UberMassiveGaming
@UberMassiveGaming 3 жыл бұрын
Thanks, recently installed a dialogue system plugin and was surprised that they didn't implement keyboard/controller functionality built in.
@hollowthing3259
@hollowthing3259 3 жыл бұрын
This is amazing! Not very many tutorials show you how to do these things!
@richardmolina3d321
@richardmolina3d321 2 жыл бұрын
Thank you, I went from a 900 code line "solution" to this 12 liner... its like GI Joe, knowing is half the battle, and man was I goin the wrong direction
@ariefnugraha243
@ariefnugraha243 2 жыл бұрын
This is such a 100% Unity moment Thanks for the tutorial tho
@Visuwyg
@Visuwyg 3 жыл бұрын
Thank you, this tutorial had some vital tips in it, even for a Bolt User like me!
@Blake-Lawton-Dev
@Blake-Lawton-Dev 4 жыл бұрын
This is a great follow up video for all your menu videos. Thank you!
@HaydenTheEeeeeeeeevilEukaryote
@HaydenTheEeeeeeeeevilEukaryote 4 жыл бұрын
is there a good way to make it so when you do hover over something with your mouse it switches that button to the selected one as if the control stick moved it there? it’s weird having multiple buttons highlighted at once and depending on the project it can be weird having nothing highlighted when the mouse isnt on anything
@thehailey
@thehailey 4 жыл бұрын
You could cast a ray from the cursor, then if it returns a hit on a button make that button the selected button using a script. It would use the same method as you'd use to select units in an rts style game.
@adamwright5980
@adamwright5980 4 жыл бұрын
On the button add component>event trigger Then add an event "pointer enter" Drag the button into the event's slot. use the dropdown that says "no function" and choose "Button> Select()" That will make it so that when your mouse hovers over the button it is selected. Using the control stick will navigate the buttons again. Because it's a "pointer enter" event it won't go off again until your mouse leaves the button and comes back.
@HaydenTheEeeeeeeeevilEukaryote
@HaydenTheEeeeeeeeevilEukaryote 4 жыл бұрын
@@adamwright5980 thank you
@Old_SDC
@Old_SDC 3 жыл бұрын
Thanks for the tutorial! Sadly because of how my old menu worked I have to remake the entire thing to use this but 100% worth it.
@martindubois9279
@martindubois9279 2 жыл бұрын
damn if you had to remake everything and you followed this tuto sorry to say that but you gotta remake it again soon lol. new input system is a way more powerfull + new ui toolkit is even more powerfull. you no longer need the update function in both case
@koseki_stuff
@koseki_stuff 2 жыл бұрын
if you cant scroll through buttons, make sure all your buttons that you want to scroll through have the "automatic" navigation on. i feel like most would have it on none (to account for pc) but if this helps im glad
@junglejim6674
@junglejim6674 Жыл бұрын
ty sir
@jacobester3846
@jacobester3846 4 жыл бұрын
Very good, thanks! I thought I was going to have to program the keyboard/ui interaction from scratch.
@27PhilSnow
@27PhilSnow 4 жыл бұрын
Thank you so much for this tutorial! Exactly what I needed :)
@RoryStarks
@RoryStarks 4 жыл бұрын
This is great, very straightforward
@prabdeepdhaliwal8285
@prabdeepdhaliwal8285 4 жыл бұрын
i love you man, you have very helpful videos!!! very underrated.
@willardpeng5941
@willardpeng5941 2 жыл бұрын
This is what I really need. Thank You!
@darkmaigo
@darkmaigo 4 жыл бұрын
The best of the bests, thank you so much for this tutorial teacher
@bffever8803
@bffever8803 Ай бұрын
Thank you for this amazing video
@steveszymczak448
@steveszymczak448 6 күн бұрын
4 years late, but i have a question: I have an ability tray in my game (think like WoW RPG style class abilities). For playing with a game pad, I want the player to hit A to switch control over to that ability tray (which is a set of buttons, essentially). How do i do this? Because i don't want to hide the ability tray. I just want to leave it in a non-interactable state until something (player hitting A) activates the button. An example of this and an inspiration for my approach is in Into The Breach.
@baihua-launewbee
@baihua-launewbee Күн бұрын
Thanks! just what i need
@user-rq8hz5lq6h
@user-rq8hz5lq6h 3 жыл бұрын
Thank you sooooooo much this video was really helpful!
@rightanglegames
@rightanglegames 4 жыл бұрын
Just what I needed to know! Thanks for this tutorial!
@JamesArndt
@JamesArndt Жыл бұрын
I see you also have the double highlight bug where hovering over a button with the mouse does not clear the selected highlight from the keyboard selection. In essence you'll have two green highlighted buttons if you select one and hover over another.
@Zvrra
@Zvrra 4 жыл бұрын
been always wanting to do this lol
@FlashBreakerOfficial
@FlashBreakerOfficial 3 жыл бұрын
best UI controll tutorial, thanks you
@LNmaster-ko7wb
@LNmaster-ko7wb 3 жыл бұрын
But If I Click Mouse I Cannot Navigate Using Keyboard What Should I Do?
@tomasb96
@tomasb96 4 жыл бұрын
Life saver right here! Thank you
@sealsharp
@sealsharp 4 жыл бұрын
Very helpful. Thanks James!
@sinho113
@sinho113 Жыл бұрын
exactly what i need s2
@NathanPrince1
@NathanPrince1 2 жыл бұрын
great video, helped me out alot stright to the point with all the infomation needed for the event system. no more making custom menu systems yay :)
@arpatronik
@arpatronik 5 ай бұрын
at minute 8, why do you first make a SetSelectedGameObject(null) and instantly in the next lane give a value? I mean, it's not the same doing only the second step?
@llibertii
@llibertii 2 жыл бұрын
Worked flawlessly!!!
@victorlecam1813
@victorlecam1813 4 жыл бұрын
Hey, first I want to thank you for your videos that always help me for ... almost everything in gamedev ! I have a problem though with my first button not being highlighted with the event system trick... do you have any clue where it could come from ? Take care and keep it up :)
@kupapapaz6192
@kupapapaz6192 Жыл бұрын
you are smarter than chat gpt and u are the best man in the world ı love u
@sherwooddevlog9245
@sherwooddevlog9245 3 жыл бұрын
You're a lifesaver!
@inkofthedragon
@inkofthedragon Жыл бұрын
I'm trying to implement this with an inventory and equip system. So i can hover over an item which has a button. But how do i get the X button on the controller to register a click on the specific button. Next, how would i trigger an event to call the EquipItem function inside of inventory? Thanks
@oatmealch
@oatmealch 3 жыл бұрын
I should have watched this before I hard-code all my stuffs!!
@GustavoPLima
@GustavoPLima 3 жыл бұрын
thanks man, you help me a lot! "Muito Obrigado" from brasil
@fuselier9638
@fuselier9638 4 жыл бұрын
You are a lifesaver
@DrFross09
@DrFross09 4 жыл бұрын
to open the options are we supposed to be using the click() event ( I think he or I ) must have missed that step... I can't find anywhere in the code that fires OpenOptions, so I'm guessing that's ho he's doing it.
@mreimer01
@mreimer01 4 жыл бұрын
Very helpful tutorial.
@mauriciofonseca6404
@mauriciofonseca6404 6 ай бұрын
Great tutorial!
@my2cents366
@my2cents366 3 жыл бұрын
Great tutorial, Thanks.
@alivahidi8611
@alivahidi8611 3 жыл бұрын
Thanks for nice and helpful video
@neenaw
@neenaw 4 жыл бұрын
Helped my out a lot, thanks!
@szkokee
@szkokee 3 жыл бұрын
I dont understand, the bool values to set the menus active(true/false) on my buttons dont even work if i set them up as code like you. I dont understand how does your work. I have to set them up manually in Unity but then - i guess because of this - the button selection dont translates onto the next menu.
@Curtis_
@Curtis_ Жыл бұрын
great video, thank you!
@e4gywanking
@e4gywanking Жыл бұрын
man's a god
@cosmemartinez144
@cosmemartinez144 3 жыл бұрын
You just solved all my life!!!! Thanks
@boxitor9355
@boxitor9355 4 жыл бұрын
always waiting this
@tudougames86
@tudougames86 4 жыл бұрын
Great tutorial, thanks a lot!
@lomjnkhji2145643
@lomjnkhji2145643 Жыл бұрын
hi, I was trying to select the different buttons of the menu from my controller but it didn't worked
@mwmdragon
@mwmdragon 3 жыл бұрын
Can you record an updated version of this for the new Input System?
@TheOnlyKaas
@TheOnlyKaas 9 ай бұрын
Thank you!
@dylanobrien462
@dylanobrien462 Жыл бұрын
Amazing thanks man
@MikeToth1
@MikeToth1 2 жыл бұрын
I have this weird issue, where the navigation with keyboard works fine. It also selects the right button in a new menu. But somehow, it doesn't work with a controller. A can navigate through the menu as with a keyboard, but it doesn't select the first button. So the same code is working with a keyboard, but with a controller not. Respecitvely, the navigation itself does, but the selecting not. Did anyone had this issue as well? Thank you very much
@ZAYMANGAMESTUDIO
@ZAYMANGAMESTUDIO Жыл бұрын
Me too.
@internetbystander
@internetbystander 4 жыл бұрын
Thank you for this!
@KENISEG
@KENISEG Жыл бұрын
2:11 wtf, HOW? I can't press button via gamepad, just navigate across menu
@14DimensionEnterprise
@14DimensionEnterprise 4 жыл бұрын
then, how to move selection between toggles? by keyboard direction keys?
@Clodiosvaldo
@Clodiosvaldo 3 жыл бұрын
Thank you So much!
@XiroNyakuya
@XiroNyakuya 4 жыл бұрын
Okay now I'm calling the function inside Unity from the On Click() of the Button, but using both lines from the minute 8:00 does not update the Cursor at all. My menu it's working but it does not display any cursor, just the one of the beginning.
@dream_catcher7725
@dream_catcher7725 3 жыл бұрын
is there a way to keep holding the button and keep moving throw the menu like input.getkey in the coding reference but without code (intead of the ui default navigation that look like (input.getkeydown))
@14DimensionEnterprise
@14DimensionEnterprise 4 жыл бұрын
I set similar with above with toggles, but not work. no move selection.
@mantavisions2362
@mantavisions2362 2 жыл бұрын
Amazing thanks!
@leoniest-onge2115
@leoniest-onge2115 Жыл бұрын
THANK YOU FOR THIS!!!!!!!!
@skrya1248
@skrya1248 3 жыл бұрын
Super useful!
@sledgeweb
@sledgeweb 4 жыл бұрын
If you reply to comments, I echo Hayden's questions... you left a pretty obvious flaw in here, what if the user can use gamepad/keyboard OR mouse (like you are doing in the example video), and the selected object isn't deselected when the mouseover highlights another button - so you end up with multiple highlighted buttons. It happens a few times in your video, so it would be great if you provided a solution for this.
@thehailey
@thehailey 4 жыл бұрын
You can use a ray cast from the cursor to update the selected button to the one under the mouse when the mouse is over a button.
@avimalviya
@avimalviya 2 жыл бұрын
i need that solution too.
@coquetteshadow
@coquetteshadow 4 жыл бұрын
Hey thanks alot. This was super helpful;
@MarkStixia
@MarkStixia 4 жыл бұрын
Thank you.
@proximacentauri9509
@proximacentauri9509 2 жыл бұрын
Nice tutorial! But I have a question. How to control a Virtual Joystick of a finished game with Xbox controller? In short, how to move the Joystick without putting your finger on the screen (but the controller instead) ?
@ZAYMANGAMESTUDIO
@ZAYMANGAMESTUDIO Жыл бұрын
That’s also my concern 😢.
@ZAYMANGAMESTUDIO
@ZAYMANGAMESTUDIO Жыл бұрын
But what about a game pad? I tried my PS4 joystick and didn’t work.
@sajidgame1321
@sajidgame1321 4 жыл бұрын
thank you is very nice tutorial
@benjamindehjooriyan6407
@benjamindehjooriyan6407 4 жыл бұрын
can you make a tutorial about how to do circular touch ? i want to detect a circle touch to do some lines.
@ZeroTubeTV
@ZeroTubeTV 2 жыл бұрын
Awesome, it works like a charm! :)
@marscaleb
@marscaleb 2 жыл бұрын
I put in the same code, but when I call that function I wind up not selecting anything. The button itself has an ISelectHandler on it that updates other text on my screen when the button is selected, and that part updates. But the button is not highlighted and I can't navigate between anything.
@JavierCruz12
@JavierCruz12 2 жыл бұрын
Same problem
@Naakoo_
@Naakoo_ 2 жыл бұрын
@@JavierCruz12 Same here
@snigames
@snigames 25 күн бұрын
Thank you very much!!! This worked for my game! That was reallllllllyyyyyyyy awesome and realllllllyyyyyyyyy easy!!
@DanielCenciD
@DanielCenciD 2 жыл бұрын
Thanks a lot
@greatgardna2589
@greatgardna2589 3 жыл бұрын
Tried everything and followed the video, my script just doesn't work.
@madmanga64
@madmanga64 4 жыл бұрын
Awesome thanks!
@snoopyuj
@snoopyuj 3 жыл бұрын
Thank you!!
@TheEsaltasanba
@TheEsaltasanba Жыл бұрын
u r god man
@inakisoler4221
@inakisoler4221 3 жыл бұрын
How can I do via script to press a button? E.g: if (Input.GetButtonDown(PS4_X)) --> this button gets pressed;
@danjquiroz
@danjquiroz 3 жыл бұрын
THANK YOUUUUUU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@haydendev
@haydendev Жыл бұрын
thaaaaaaanks
@DewaPoyo
@DewaPoyo 4 жыл бұрын
Perfect!
@nickprice6644
@nickprice6644 4 жыл бұрын
Activating the Options Button Hi, I'm able to select the options button on the 'Pause Menu' but I can't find a way of activating it other than by pressing the Enter button on a keyboard. My 'On Click()' event on the Options button is set as 'Runtime only' the object is set to the canvas that contains the menu code and I've selected TestMenu.OpenOptions. I assume that its something that I've not setup. I'm using Unity 2019.4.0f1 Thanks & Regards Nick
@nickprice6644
@nickprice6644 4 жыл бұрын
Oops Didn't realise that I'd have to click the 'A' on the controller. Nick
@nocultist7050
@nocultist7050 3 жыл бұрын
scrollrect, how do I make scrollrect follow selection?
@GuyWithChainsaw
@GuyWithChainsaw 3 жыл бұрын
Hey there. I have a quick question. Let's say I made an rpg style inventory. I saw there is a lot of tutorials for them. My question is, Can I control an inventory like that the same way I could control the menu in your tutorial?
@martindubois9279
@martindubois9279 2 жыл бұрын
for inventory system i suggest you to use ui toolkit. you can download the inventory system sample :)
@GuyWithChainsaw
@GuyWithChainsaw 2 жыл бұрын
@@martindubois9279 Oh. Thanks a lot! I'll look into it
@harimrlocal
@harimrlocal Жыл бұрын
how to implement this in start menu for options
@FyresGames
@FyresGames 3 жыл бұрын
Hey Are you the one who made Learn To Create An RPG Game in Unity on Udemy? Your voice seem familliar.
@SaikingSS
@SaikingSS 4 жыл бұрын
Graet Tutorial!
CONTROLLER INPUT in Unity!
16:44
Brackeys
Рет қаралды 373 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 82 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 129 МЛН
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 9 МЛН
How to Control Your Menu with Keyboard/Gamepad | Unity Tutorial
9:43
Sasquatch B Studios
Рет қаралды 25 М.
Why you should use code to animate your UI in Unity.
5:02
Game Dev Guide
Рет қаралды 334 М.
Unity's NEW input system in 13 minutes
13:02
BiteMe Games
Рет қаралды 26 М.
IPC: To Share Memory Or To Send Messages
14:15
Core Dumped
Рет қаралды 53 М.
UNITY + PLAYMAKER 🕹️ How To Make A Main Menu
26:06
Game Dev Corner
Рет қаралды 18 М.
Why you should switch to Unity's New Input System (and how easy it is)
9:51
Jason Weimann (GameDev)
Рет қаралды 34 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 82 МЛН