Anyway Thanks for watching guys, and i want to point out that you can directly hook the [vertical box -> get all children] to the for each loop instead of remapping it to a new array so you are saving yourself a forEach loop, some things in this tutorial can be achieved in different ways, as always when programming! You can also experiment with callbacks, interfaces or dispatchers to handle the Click Event on the menu, but anyway this should be sufficent for a Static Main Menu with a defined set of options! Don't forget to Share and Sub, and if you have any question Just ask Below, i'll respond as soon as i can.
CIAO! Sono sull'editor UE5.4.1 e ho seguito esattamente le tue istruzioni, ma qualcosa non sembra funzionare. Quando provo i pulsanti che mostri al minuto 25.10, semplicemente non funzionano e i pulsanti non vengono evidenziati. Cosa può essere? Mi sta facendo impazzire sta cosa
Thanks for the tutorial; helped me get basic functionality for the menu with the gamepad. One thing I learned is that you can use the 'listen for input' node inside your menu blueprint to get your input actions instead of using the keyDown function and hard coding all the buttons for your menu input. Note this doesn't work if you use UI only input mode or set game paused.
Just in case anyone is having problems with the keyboard inputs not working a possible solution is that the "Is Focusable" option does not do what it should for you. There is probably a better way to solve this but i just created an "event tick" and connected it to "set keybaord focus" inside the widget and it works fine now.
Couldnt use all of it, but some of this was really helpful. Thanks for this. I had to figure a lot out because I made the buttons a widget as well. But this was useful.
Hi there, great tutorial! Thanks for the help. I'm having some trouble with the workings of it though, can anyone shed a light please? The keyboard/gamepad integration is working wonders, however, when I click anywhere else on the screen, while the HUD Widget is open, other than the buttons themselves, I'm no longer able to move or register any of the keyboard/gamepad events.
23:32 - This occurs because length for arrays starts at a 0. An example helps. If you have 4 items in an array, that array has 4 items in it. They are numbered 0, 1, 2, and 3. Let's say we start at Menu Navigation Index 3 (the last one). If you press up, the logic here is comparing the menu navigation you're trying to reach (index 3 + 1 = 4) to the length of the MenuItems (max length 4) Since the MenuNavigationIndex (4) is NOT greater than the MenuItemsLength (4), the branch will return false. This is REALLY BAD, because we're creating logic that grabs the item from MenuItems whose value corresponds to our MenuNavigationIndex Continuing the above example, 4 is not greater than 4 -> Grab the item at index (MenuNavigationIndex) from MenuItems = grab the item at Index 4 from MenuItems... which only has values at index 0, index 1, index 2, and index 3. Error, OutOfBoundsException, crash, bad times. This is why we subtract 1 from the MenuItems Length. Let's try again. Is our desired MenuNavigationIndex (4) less than the MenuItems Length - 1 (4-1 = 3)? Yes! Now the branch is true. This means we fix the MenuNavigationIndex, which means we never grab Index #4. No OutOfBounds, no crash, all good!
Correct i got confused in the video, been programming for years and falling into such a stupid thing shame on me 💀 Thanks for the detailed explanation!
@@cibe no shame at all, video creation is hard. Harder when you're thinking at the same time. The comment was for other voewers who didn't understand. I figured you knew why :)
@@itanocircus2077 Exactly! And totally shame on me ahah rewatching the videos i always see i make some mistakes, but that also good for me to improve! I know the comment was for the viewers, i love when people comment with detailed explanations because it helps everyone!
13:12 where set the MenuNavigationIndex ? If the function executed, equal Branch is only true "0". Cause Default is Zero. My Case is first button works but the others don't work. It seems to change right before button when i hovered it... Any Advice?
Thanks for the effort, but I genuinely cannot believe that this is still a problem, and still absurdly difficult to set up this far into UE's development... How the heck are you supposed to make a dynamic inventory that works on gamepad, or a big settings menu? Hard coding everything individually like this just wouldn't work.. Any possibility at all you could look into any method of making the assignments a bit less static and hard coded?
Thats something i never tought about, and you are probably right that this tutorial is not suitable for something like that, my guess is probably using the index of an array containing all the items of the inventory, or controlling focus/tab focus to achieve something like that, if i figure it out, i'll definetly make a new tutorial.
@Cibe thanks for the response. Really appreciate your thoughts. But yeah I've never found a clean way to implement gamepad controls for something like that so I've always had to either forget about gamepad input or simplify my menus so much that they suck.
Hey, i got it with really few blueprints, i'll reply here with a link to the video as soon as i upload it! It is a very basic tutorial to get you started, so you will need to handle some stuff yourself, but it works, It is based on an array like i said before, So the logic will be -> You pick up an item, you add it to the Array -> you handle the inventory update visually by iterating the array or doing some diffing so you don't refresh the entire inventory visually each time, from here you can use the system coming with my next video that will allow you to navigate the inventory in every direction, you can make multiple items blueprints and each of them will have its own click logic
@@cibe thank you for your reply! I mean the default system that focuses automatically on the button for the button instead of hard coding the selection, is there a specific reason or it is just to have more control and flexibility?
@@matteomaravalle5461 oh i get it now, yeah the standard focus is good for simple things, but on the long run if you need to achieve complex behaviours it is better to make a custom system, the standard focus system is kinda limited and not customizable
This worked great, just have a problem. I created a "BACK" button for my credits. When I press on the credits button in the main menu, the credits open, but when in the credits, I can only go back to main menu if I hover over the back button with the mouse and click, but nothing happens with the gamepad? I duplicated the main menu widget, and made it credits, to have gamepad work with specific widgets without having to do all the code again. Is it because there's only 1 button in credits? (The back Button)
I'm not quite sure if thats the case, but could be the same focus problem i was having, try to add a Set Keyboard Focus to your event constructor in each Widget that should work with keybord and mouse, if this is not the case the issue might be somewhere else.
Could be that only one index breaks the system aswell, but i believe once you press a key it should enter the index 0 anyway and stay there, so might just be a focus problem in the end
Just one more quick question. Have you ever figured out how to go left and right in menu with game pad, for if I had an options menu with buttons horizontal and verticle?
Great tutorial! Thanks! But there was a problem: if you go to another widget (for example options), and then go back to the main menu widget, the color of the buttons does not change (((
While this does the job well I'm honestly baffled by the complicacy of this. For example, I have multiple layers of UI and going by this approach I am now maintaining various variables holding the index of which part of UI is currently activated and then further variables holding the index of current selection. Did you find some other way for navigating using controllers and keyboards. I'm going to look into other tutorials after I post this comment. Anyway this is the first time I'm programming controller support so maybe that's why I'm finding it unreasonably complicated. I used to think you would just define which button is to the left and which is to the right. I was wrong on so many levels.
It is unreal fault, however it probably can be easier on unreal engine 5 with controls mappings, but i have yet not tested this, as in my project i need to support ue4
Thumbsitck dont working because u compare "Get Key" to "Gamepad left thumbstic Y-Axis" Not to "Left Thumbstick Down or Up" All You need is just search for left thumbstick down or up. instead of clicking on "icon" to assign button by detect.
I don't get it. Why do you need to do all of that when you can simply use {SetKeyboardFocus()} ? The navigation will work fine using this. But, if I'm not mistaken, it will only work when using gamepad (not ps4/ps5 by default - these will need further work using raw input plugin), and not when using keyboard arrow keys.
@@kingalonsoiv Sorry for being late. On Unreal Engine UMG, the gamepad (Xbox by default) works great with navigation, and button click detection (Using A button). The work around is simply by using Button->SetKeyboardFocus(); It's not as easy when to comes to a more complicated UMGs, for example you need to change the Focus based on the Menu the player is currently in, but that's not a big issue, the input detection such as Y,X,B for opening or closing sub-menus, or navigate back, and so on (You can do whatever you want), can be easily done with something like the OnKeyDown Overridden Event, and there's more events for that depends on the situation of the UMG. One down side though, is the lack of support for the RawInput plugin for when it comes to detecting if player is using a gamepad (GenericUSBController__) keys are registered as a keyboard input, not a gamepad, but that can easily be fixed by changing the source code, though, still not done yet; The UMG won't work still when using RawInput Plugin. If you need the best UMG results using a gamepad like Xbox, I suggest you to use the CommonInput Plugin, it'll make a lot of impossible things to be possible, and make your developing journey a lot easier. Currently I can use Xbox controllers in-game and in-umg, as well as the RawInput Plugin, I succeeded to make it work with DualSense and DualSense Edge/ DualShock controllers of all versions (ps4,ps5), in-game, the only issue for these is the UMG, I'm still not sure how make this work perfectly but; I'll change the source code of CommonInput Plugin, and make a new device type to be RawInput, and from there I'll also make my own code to detect what controller the player is using, with it's Full-Name using the VID & PID, from there I think I'll be able to make a functionality in my ButtonBase class and in case the player was using RawInput (inside the on key down event, etc) then depending on the button he clicks, say he clicked X (same as A button on Xbox), then I call a broadcast to trigger the on clicked event, I'll also make it to work with navigation as well when player moves L3 up/down/left/right, and perhaps R3 as well, using the navigation call in the button it self inside the UMG editor, in addition to the Menu Input Icons, currently I've support for KBM/Xbox, but I'll add a 3rd type for both Ps4/Ps5 controllers. I may build the whole system again which is a long run, but I may end up making it a small plugin so I can use it on any project I'll build in the future! Good Luck.
30:55 you're doing an == for every index, which is suuuper inefficient. I'd just use a Switch on Int if you're going to do it that way. Edit a few seconds later: Nevermind, you did just that. Lol
Hello friend can you continue with the tutorial on how to control widget making a configuration menu, how to move with the joystick or control L1 and L2 change the screen modes or lower the volume, and how to hide the mouse if you are with the gamepad when it detects it or you move any button and if you move the mouse the mouse is displayed, and when you switch between widget how not to lose the Focus and continue controlling with the gamepad, can you do or know how to do it, I would greatly appreciate a tutorial.🤗✌️✌️✌️✌️
the joystick you can map with "gamepad left thumbstick up" or "gamepad left thumbstick down" rather than the axis options which don't help in this case :)
Shame of you Epic Games Inc. ! Why is so hard to use a basic gamepad in menu ! With movement of the character it's so easy, project settings/inputs then Axis/Action Mapping and THAT'S ALL ! Do the same thing for widgets and their buttons and sliders ! Never see that ! Sometimes I work in Unity, more simple but no blueprint ! (not yet) ! They want you pay any expensive plugin on the epic marketplace, and even with that, some buttons or sliders doesn't work every time ! Anyway...
man you are right. Epic game is focusing in just graphics and they do not improve saving and loading system or widget blueprint. there is new what is called UI common, but there is no enough documents about
@cibe No errors, but I had to delete the top part after the click event you had made because it stopped my game from working. After building, the arrows move the character, but not the buttons.
Anyway Thanks for watching guys, and i want to point out that you can directly hook the [vertical box -> get all children] to the for each loop instead of remapping it to a new array so you are saving yourself a forEach loop, some things in this tutorial can be achieved in different ways, as always when programming! You can also experiment with callbacks, interfaces or dispatchers to handle the Click Event on the menu, but anyway this should be sufficent for a Static Main Menu with a defined set of options! Don't forget to Share and Sub, and if you have any question Just ask Below, i'll respond as soon as i can.
cast to button is failing
CIAO! Sono sull'editor UE5.4.1 e ho seguito esattamente le tue istruzioni, ma qualcosa non sembra funzionare. Quando provo i pulsanti che mostri al minuto 25.10, semplicemente non funzionano e i pulsanti non vengono evidenziati. Cosa può essere? Mi sta facendo impazzire sta cosa
Thanks for the tutorial; helped me get basic functionality for the menu with the gamepad. One thing I learned is that you can use the 'listen for input' node inside your menu blueprint to get your input actions instead of using the keyDown function and hard coding all the buttons for your menu input. Note this doesn't work if you use UI only input mode or set game paused.
Just in case anyone is having problems with the keyboard inputs not working a possible solution is that the "Is Focusable" option does not do what it should for you. There is probably a better way to solve this but i just created an "event tick" and connected it to "set keybaord focus" inside the widget and it works fine now.
I put mine in the construct and it workes aswell :)
Thank you very much for this!
Worked just fine in U.E.5, ty so much!
love the "I have a little bit of problem with the controller" and then *smack smack* (19:15)
Ahaha Percussive maintenance ftw!
You saved me and my project, thank you man
Couldnt use all of it, but some of this was really helpful. Thanks for this. I had to figure a lot out because I made the buttons a widget as well. But this was useful.
Thank you very much. great tutorial.
This was a really good video. It is going to be a PAIN to add this to all my UI but will certainly be more than worth it.
Hi there, great tutorial! Thanks for the help.
I'm having some trouble with the workings of it though, can anyone shed a light please?
The keyboard/gamepad integration is working wonders, however, when I click anywhere else on the screen, while the HUD Widget is open, other than the buttons themselves, I'm no longer able to move or register any of the keyboard/gamepad events.
23:32 - This occurs because length for arrays starts at a 0. An example helps.
If you have 4 items in an array, that array has 4 items in it. They are numbered 0, 1, 2, and 3.
Let's say we start at Menu Navigation Index 3 (the last one).
If you press up, the logic here is comparing the menu navigation you're trying to reach (index 3 + 1 = 4) to the length of the MenuItems (max length 4)
Since the MenuNavigationIndex (4) is NOT greater than the MenuItemsLength (4), the branch will return false.
This is REALLY BAD, because we're creating logic that grabs the item from MenuItems whose value corresponds to our MenuNavigationIndex
Continuing the above example, 4 is not greater than 4 -> Grab the item at index (MenuNavigationIndex) from MenuItems = grab the item at Index 4 from MenuItems... which only has values at index 0, index 1, index 2, and index 3.
Error, OutOfBoundsException, crash, bad times.
This is why we subtract 1 from the MenuItems Length. Let's try again.
Is our desired MenuNavigationIndex (4) less than the MenuItems Length - 1 (4-1 = 3)? Yes!
Now the branch is true. This means we fix the MenuNavigationIndex, which means we never grab Index #4.
No OutOfBounds, no crash, all good!
Correct i got confused in the video, been programming for years and falling into such a stupid thing shame on me 💀
Thanks for the detailed explanation!
@@cibe no shame at all, video creation is hard. Harder when you're thinking at the same time.
The comment was for other voewers who didn't understand. I figured you knew why :)
@@itanocircus2077 Exactly! And totally shame on me ahah rewatching the videos i always see i make some mistakes, but that also good for me to improve!
I know the comment was for the viewers, i love when people comment with detailed explanations because it helps everyone!
THANK YOU FOR SHARING THIS VIDEO .. I LOVE IT
Hay for some reason doing this has stop my play character moving when going to the next level after play....any help would be great
Its probably a focus issue try to switch game focus using the related blueprints
Try game only or game and UI
Thank You
To allow control back to the pawn you need to put a input gamecontrols before the level loads.
13:12 where set the MenuNavigationIndex ? If the function executed, equal Branch is only true "0". Cause Default is Zero. My Case is first button works but the others don't work. It seems to change right before button when i hovered it... Any Advice?
sovled ) I added Spacer not Padding. So I deleted Spacer it works :)
Thank you, sir, which version of unreal engine do you work in?
i believe this was 4.27 it was the version i used the most until UE 5.4 that now seems to be stable finally
Thanks for the effort, but I genuinely cannot believe that this is still a problem, and still absurdly difficult to set up this far into UE's development... How the heck are you supposed to make a dynamic inventory that works on gamepad, or a big settings menu? Hard coding everything individually like this just wouldn't work..
Any possibility at all you could look into any method of making the assignments a bit less static and hard coded?
Thats something i never tought about, and you are probably right that this tutorial is not suitable for something like that, my guess is probably using the index of an array containing all the items of the inventory, or controlling focus/tab focus to achieve something like that, if i figure it out, i'll definetly make a new tutorial.
@Cibe thanks for the response. Really appreciate your thoughts. But yeah I've never found a clean way to implement gamepad controls for something like that so I've always had to either forget about gamepad input or simplify my menus so much that they suck.
About the keys hardcoding, in UE5 it is probably not necessary as you can now create Key Mappings context
Hey, i got it with really few blueprints, i'll reply here with a link to the video as soon as i upload it! It is a very basic tutorial to get you started, so you will need to handle some stuff yourself, but it works, It is based on an array like i said before, So the logic will be -> You pick up an item, you add it to the Array -> you handle the inventory update visually by iterating the array or doing some diffing so you don't refresh the entire inventory visually each time, from here you can use the system coming with my next video that will allow you to navigate the inventory in every direction, you can make multiple items blueprints and each of them will have its own click logic
@@cibe Thank you so much for thinking into this! I really appreciate it! Thanks. I look forward to seeing your method :)
Nice video, thank you! I have a (maybe stupid) question: why not using the focus status, is there a specific reason? Thank you!
If you mean the "is Focusable" boolean, it's because it won't let you use the On Key Down override
@@cibe thank you for your reply! I mean the default system that focuses automatically on the button for the button instead of hard coding the selection, is there a specific reason or it is just to have more control and flexibility?
@@matteomaravalle5461 oh i get it now, yeah the standard focus is good for simple things, but on the long run if you need to achieve complex behaviours it is better to make a custom system, the standard focus system is kinda limited and not customizable
@@cibe thank you it’s clear! ☺️
This worked great, just have a problem. I created a "BACK" button for my credits. When I press on the credits button in the main menu, the credits open, but when in the credits, I can only go back to main menu if I hover over the back button with the mouse and click, but nothing happens with the gamepad? I duplicated the main menu widget, and made it credits, to have gamepad work with specific widgets without having to do all the code again. Is it because there's only 1 button in credits?
(The back Button)
I'm not quite sure if thats the case, but could be the same focus problem i was having, try to add a Set Keyboard Focus to your event constructor in each Widget that should work with keybord and mouse, if this is not the case the issue might be somewhere else.
Could be that only one index breaks the system aswell, but i believe once you press a key it should enter the index 0 anyway and stay there, so might just be a focus problem in the end
@cibe I'll give it a shot! Still a great tutorial, and worked well for the main menu part!
@@cibe Yes! It worked! Thnx❤️❤️🙌🏾🙌🏾
Just one more quick question. Have you ever figured out how to go left and right in menu with game pad, for if I had an options menu with buttons horizontal and verticle?
I can't move forward up and down when i unpause for controller
Great tutorial! Thanks! But there was a problem: if you go to another widget (for example options), and then go back to the main menu widget, the color of the buttons does not change (((
How can you change to hovered image instead of just the background colour?
You should use and target 2D Textures if i remember correctly
And with Unreal Engine 5 i will take a look on build in plugin (just turned off) "Common UI Plugin" seems easier way to do it.
Thank you very much. But Why I need to use mouse click into viewport once to toggle keyboard/gamepad input? Is there any solution?
Actually, i'm facing the same issue on a project, it is a focus problem, i solved it by adding Set Keyboard Focus on Event Construct in the Menu UMG
While this does the job well I'm honestly baffled by the complicacy of this. For example, I have multiple layers of UI and going by this approach I am now maintaining various variables holding the index of which part of UI is currently activated and then further variables holding the index of current selection.
Did you find some other way for navigating using controllers and keyboards. I'm going to look into other tutorials after I post this comment. Anyway this is the first time I'm programming controller support so maybe that's why I'm finding it unreasonably complicated.
I used to think you would just define which button is to the left and which is to the right. I was wrong on so many levels.
It is unreal fault, however it probably can be easier on unreal engine 5 with controls mappings, but i have yet not tested this, as in my project i need to support ue4
Thumbsitck dont working because u compare "Get Key" to "Gamepad left thumbstic Y-Axis" Not to "Left Thumbstick Down or Up" All You need is just search for left thumbstick down or up. instead of clicking on "icon" to assign button by detect.
Thanks, i realized this later on
Thanks❤🔥
I don't get it. Why do you need to do all of that when you can simply use {SetKeyboardFocus()} ? The navigation will work fine using this. But, if I'm not mistaken, it will only work when using gamepad (not ps4/ps5 by default - these will need further work using raw input plugin), and not when using keyboard arrow keys.
can you elaborate a bit more?
@@kingalonsoiv Sorry for being late. On Unreal Engine UMG, the gamepad (Xbox by default) works great with navigation, and button click detection (Using A button). The work around is simply by using Button->SetKeyboardFocus();
It's not as easy when to comes to a more complicated UMGs, for example you need to change the Focus based on the Menu the player is currently in, but that's not a big issue, the input detection such as Y,X,B for opening or closing sub-menus, or navigate back, and so on (You can do whatever you want), can be easily done with something like the OnKeyDown Overridden Event, and there's more events for that depends on the situation of the UMG.
One down side though, is the lack of support for the RawInput plugin for when it comes to detecting if player is using a gamepad (GenericUSBController__) keys are registered as a keyboard input, not a gamepad, but that can easily be fixed by changing the source code, though, still not done yet; The UMG won't work still when using RawInput Plugin.
If you need the best UMG results using a gamepad like Xbox, I suggest you to use the CommonInput Plugin, it'll make a lot of impossible things to be possible, and make your developing journey a lot easier.
Currently I can use Xbox controllers in-game and in-umg, as well as the RawInput Plugin, I succeeded to make it work with DualSense and DualSense Edge/ DualShock controllers of all versions (ps4,ps5), in-game, the only issue for these is the UMG, I'm still not sure how make this work perfectly but; I'll change the source code of CommonInput Plugin, and make a new device type to be RawInput, and from there I'll also make my own code to detect what controller the player is using, with it's Full-Name using the VID & PID, from there I think I'll be able to make a functionality in my ButtonBase class and in case the player was using RawInput (inside the on key down event, etc) then depending on the button he clicks, say he clicked X (same as A button on Xbox), then I call a broadcast to trigger the on clicked event, I'll also make it to work with navigation as well when player moves L3 up/down/left/right, and perhaps R3 as well, using the navigation call in the button it self inside the UMG editor, in addition to the Menu Input Icons, currently I've support for KBM/Xbox, but I'll add a 3rd type for both Ps4/Ps5 controllers.
I may build the whole system again which is a long run, but I may end up making it a small plugin so I can use it on any project I'll build in the future!
Good Luck.
@@MahdiAbuHamida_wow, thank you very much, this has been very helpful
@@MahdiAbuHamida_ wow man you dont know how much this helped me in my project, love you dude
Thank u
30:55 you're doing an == for every index, which is suuuper inefficient.
I'd just use a Switch on Int if you're going to do it that way.
Edit a few seconds later: Nevermind, you did just that. Lol
You are right, the switch is a better option
Hello friend can you continue with the tutorial on how to control widget making a configuration menu, how to move with the joystick or control L1 and L2 change the screen modes or lower the volume, and how to hide the mouse if you are with the gamepad when it detects it or you move any button and if you move the mouse the mouse is displayed, and when you switch between widget how not to lose the Focus and continue controlling with the gamepad, can you do or know how to do it, I would greatly appreciate a tutorial.🤗✌️✌️✌️✌️
the joystick you can map with "gamepad left thumbstick up" or "gamepad left thumbstick down" rather than the axis options which don't help in this case :)
in Unreal 5 the solution seems to no longer work
Is this UE 3?
No? Unreal 4.27.2
ON PREVIEW DOWN works way better than ON KEY DOWN
Shame of you Epic Games Inc. ! Why is so hard to use a basic gamepad in menu ! With movement of the character it's so easy, project settings/inputs then Axis/Action Mapping and THAT'S ALL ! Do the same thing for widgets and their buttons and sliders ! Never see that ! Sometimes I work in Unity, more simple but no blueprint ! (not yet) ! They want you pay any expensive plugin on the epic marketplace, and even with that, some buttons or sliders doesn't work every time ! Anyway...
man you are right. Epic game is focusing in just graphics and they do not improve saving and loading system or widget blueprint. there is new what is called UI common, but there is no enough documents about
One of the worst tutorials I have ever watched. I mean he changed what he was doing 3 times!
Lmao, Thats how you improve things
@cibe You can make dozens of the same video, but with different ways! Anyway, mine doesn't work after the build.
@@tahmidtarique6077 do you get any errors?
also make sure to give focus to the keyboard as i pointed in other comments
@cibe No errors, but I had to delete the top part after the click event you had made because it stopped my game from working. After building, the arrows move the character, but not the buttons.