Using Menus with A Controller/Keyboard in Unity

  Рет қаралды 76,272

gamesplusjames

gamesplusjames

4 жыл бұрын

Don't forget to hit that like button and if you'd like to see more gaming goodness then subscribe for more!
Support the show by pledging at / gamesplusjames
And you can also find me on twitter and facebook!
Twitter - / gamesplusjames
Facebook - / gamesplusjames
Outro music "Theme for Harold var 1" by Kevin McLeod - www.incompetech.com

Пікірлер: 140
@brandonwaite4073
@brandonwaite4073 3 жыл бұрын
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
@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 3 жыл бұрын
Bless you man, I've been looking for this for so long. You're awesome
@Hymnal27
@Hymnal27 3 жыл бұрын
I really like how you explored the problem before jumping into solutions - thanks for the video!
@Blake-Lawton-Dev
@Blake-Lawton-Dev 4 жыл бұрын
This is a great follow up video for all your menu videos. Thank you!
@Destructivepurpose
@Destructivepurpose 2 жыл бұрын
Exactly what I was trying to figure out. Hats off to you, sir!
@patrickmorter9097
@patrickmorter9097 3 жыл бұрын
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!
@AmalieKae
@AmalieKae 4 жыл бұрын
This was SO helpful, you have no idea! Thank you so much!
@hollowthing3259
@hollowthing3259 3 жыл бұрын
This is amazing! Not very many tutorials show you how to do these things!
@prabdeepdhaliwal8285
@prabdeepdhaliwal8285 4 жыл бұрын
i love you man, you have very helpful videos!!! very underrated.
@27PhilSnow
@27PhilSnow 4 жыл бұрын
Thank you so much for this tutorial! Exactly what I needed :)
@rightanglegames
@rightanglegames 4 жыл бұрын
Just what I needed to know! Thanks for this tutorial!
@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. 🙂
@TegridyMadeGames
@TegridyMadeGames Жыл бұрын
Such a simple feature, thanks for explaining it.
@darkmaigo
@darkmaigo 3 жыл бұрын
The best of the bests, thank you so much for this tutorial teacher
@RoryStarks
@RoryStarks 4 жыл бұрын
This is great, very straightforward
@Visuwyg
@Visuwyg 2 жыл бұрын
Thank you, this tutorial had some vital tips in it, even for a Bolt User like me!
@willardpeng5941
@willardpeng5941 2 жыл бұрын
This is what I really need. Thank You!
@sealsharp
@sealsharp 3 жыл бұрын
Very helpful. Thanks James!
@tomasb96
@tomasb96 4 жыл бұрын
Life saver right here! Thank you
@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 :)
@neenaw
@neenaw 4 жыл бұрын
Helped my out a lot, thanks!
@user-rq8hz5lq6h
@user-rq8hz5lq6h 3 жыл бұрын
Thank you sooooooo much this video was really helpful!
@FlashBreakerOfficial
@FlashBreakerOfficial 3 жыл бұрын
best UI controll tutorial, thanks you
@jacobester3846
@jacobester3846 3 жыл бұрын
Very good, thanks! I thought I was going to have to program the keyboard/ui interaction from scratch.
@boxitor9355
@boxitor9355 4 жыл бұрын
always waiting this
@UberMassiveGaming
@UberMassiveGaming 2 жыл бұрын
Thanks, recently installed a dialogue system plugin and was surprised that they didn't implement keyboard/controller functionality built in.
@AJMarraffa
@AJMarraffa 3 жыл бұрын
Great tutorial, thank you so much!
@llibertii
@llibertii 2 жыл бұрын
Worked flawlessly!!!
@mauriciofonseca6404
@mauriciofonseca6404 2 ай бұрын
Great tutorial!
@sherwooddevlog9245
@sherwooddevlog9245 3 жыл бұрын
You're a lifesaver!
@tudougames86
@tudougames86 3 жыл бұрын
Great tutorial, thanks a lot!
@Curtis_
@Curtis_ Жыл бұрын
great video, thank you!
@GustavoPLima
@GustavoPLima 3 жыл бұрын
thanks man, you help me a lot! "Muito Obrigado" from brasil
@internetbystander
@internetbystander 3 жыл бұрын
Thank you for this!
@fuselier9638
@fuselier9638 3 жыл бұрын
You are a lifesaver
@cosmemartinez144
@cosmemartinez144 3 жыл бұрын
You just solved all my life!!!! Thanks
@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 :)
@dylanobrien462
@dylanobrien462 Жыл бұрын
Amazing thanks man
@mreimer01
@mreimer01 3 жыл бұрын
Very helpful tutorial.
@Old_SDC
@Old_SDC 2 жыл бұрын
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
@my2cents366
@my2cents366 2 жыл бұрын
Great tutorial, Thanks.
@alivahidi8611
@alivahidi8611 3 жыл бұрын
Thanks for nice and helpful video
@penguyYT
@penguyYT 4 жыл бұрын
Hey thanks alot. This was super helpful;
@leoniest-onge2115
@leoniest-onge2115 Жыл бұрын
THANK YOU FOR THIS!!!!!!!!
@sinho113
@sinho113 Жыл бұрын
exactly what i need s2
@mantavisions2362
@mantavisions2362 2 жыл бұрын
Amazing thanks!
@Zvrra
@Zvrra 4 жыл бұрын
been always wanting to do this lol
@skrya1248
@skrya1248 3 жыл бұрын
Super useful!
@ZeroTubeTV
@ZeroTubeTV 2 жыл бұрын
Awesome, it works like a charm! :)
@ariefnugraha243
@ariefnugraha243 2 жыл бұрын
This is such a 100% Unity moment Thanks for the tutorial tho
@TheOnlyKaas
@TheOnlyKaas 6 ай бұрын
Thank you!
@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
@14DimensionEnterprise
@14DimensionEnterprise 3 жыл бұрын
then, how to move selection between toggles? by keyboard direction keys?
@Clodiosvaldo
@Clodiosvaldo 2 жыл бұрын
Thank you So much!
@kupapapaz6192
@kupapapaz6192 Жыл бұрын
you are smarter than chat gpt and u are the best man in the world ı love u
@madmanga64
@madmanga64 4 жыл бұрын
Awesome thanks!
@sajidgame1321
@sajidgame1321 4 жыл бұрын
thank you is very nice tutorial
@DewaPoyo
@DewaPoyo 4 жыл бұрын
Perfect!
@snoopyuj
@snoopyuj 3 жыл бұрын
Thank you!!
@guigamer0077
@guigamer0077 4 жыл бұрын
Thx for video i love you
@SaikingSS
@SaikingSS 4 жыл бұрын
Graet 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.
@e4gyofficial
@e4gyofficial Жыл бұрын
man's a god
@MarkStixia
@MarkStixia 4 жыл бұрын
Thank you.
@14DimensionEnterprise
@14DimensionEnterprise 3 жыл бұрын
I set similar with above with toggles, but not work. no move selection.
@DanielCenciD
@DanielCenciD 2 жыл бұрын
Thanks a lot
@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.
@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 3 жыл бұрын
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 3 жыл бұрын
@@adamwright5980 thank you
@koseki_stuff
@koseki_stuff Жыл бұрын
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
@TheEsaltasanba
@TheEsaltasanba Жыл бұрын
u r god man
@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))
@mwmdragon
@mwmdragon 3 жыл бұрын
Can you record an updated version of this for the new Input System?
@haydendev
@haydendev 11 ай бұрын
thaaaaaaanks
@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!!
@danjquiroz
@danjquiroz 3 жыл бұрын
THANK YOUUUUUU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@arpatronik
@arpatronik 2 ай бұрын
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?
@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.
@DrFross09
@DrFross09 3 жыл бұрын
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.
@LNmaster-ko7wb
@LNmaster-ko7wb 3 жыл бұрын
But If I Click Mouse I Cannot Navigate Using Keyboard What Should I Do?
@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.
@gufrancelin7501
@gufrancelin7501 Жыл бұрын
TOP !!!!
@nocultist7050
@nocultist7050 3 жыл бұрын
scrollrect, how do I make scrollrect follow selection?
@lomjnkhji2145643
@lomjnkhji2145643 Жыл бұрын
hi, I was trying to select the different buttons of the menu from my controller but it didn't worked
@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.
@proximacentauri9509
@proximacentauri9509 Жыл бұрын
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 😢.
@FyresGames
@FyresGames 3 жыл бұрын
Hey Are you the one who made Learn To Create An RPG Game in Unity on Udemy? Your voice seem familliar.
@KENISEG
@KENISEG Жыл бұрын
2:11 wtf, HOW? I can't press button via gamepad, just navigate across menu
@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
@harimrlocal
@harimrlocal Жыл бұрын
how to implement this in start menu for options
@GuyWithChainsaw
@GuyWithChainsaw 2 жыл бұрын
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
@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.
@inakisoler4221
@inakisoler4221 3 жыл бұрын
How can I do via script to press a button? E.g: if (Input.GetButtonDown(PS4_X)) --> this button gets pressed;
@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
@ZAYMANGAMESTUDIO
@ZAYMANGAMESTUDIO Жыл бұрын
But what about a game pad? I tried my PS4 joystick and didn’t work.
@drake1205
@drake1205 Жыл бұрын
08:09 por si tengo sub menus abiertos desde mi menu
@greatgardna2589
@greatgardna2589 3 жыл бұрын
Tried everything and followed the video, my script just doesn't work.
@jesuscc9225
@jesuscc9225 4 жыл бұрын
HI, HOW YOU CONTROLL THE SELECTION BUTTON WITH A XBOX CONTROLLER?
@thehailey
@thehailey 4 жыл бұрын
You'd have to change what is received as horizontal or vertical input to the event system. In project settings, then input, you'll find all the inputs unity takes as standard. You can expand or change this as much as you want. To make it use a controller as the input you have to either change the standard horizontal and vertical settings. Or you can change what the eventsystem see from the input list as horizontal or vertical. To change the setting of an input to use say the D-pad on an xbox controller, for horizontal movement you'd make the "Type" joystick axis, and the "Axis" 6th axis. Then for vertical the same for Type (joystick axis) and then for "Axis" 7th axis. If you find a list of all the buttons and their name or axis it really helps understand what to put in each box. (This was my go to list ritchielozada.com/2016/01/16/part-11-using-an-xbox-one-controller-with-unity-on-windows-10/)
How to Control Your Menu with Keyboard/Gamepad | Unity Tutorial
9:43
Sasquatch B Studios
Рет қаралды 20 М.
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 26 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
Learning C# In A Week... Otherwise I Fail University
9:04
Coding Adventure: Portals
16:06
Sebastian Lague
Рет қаралды 1,3 МЛН
UNITY + PLAYMAKER 🕹️ How To Make A Main Menu
26:06
Game Dev Corner
Рет қаралды 18 М.
Building Unity UI that scales for a real game - Prefabs/Scenes?
59:52
Jason Weimann
Рет қаралды 140 М.
Why you should use code to animate your UI in Unity.
5:02
Game Dev Guide
Рет қаралды 329 М.
Gamepad Cursor with Input System - Unity Tutorial
35:36
samyam
Рет қаралды 35 М.
POLISH your Game with Damage Popups! (Unity Tutorial)
18:50
Code Monkey
Рет қаралды 119 М.
БАТЯ ПОМОГАЕТ МНЕ СБЕЖАТЬ в Schoolboy Runaway
29:05