How To Use Input Keys Inside Of Widgets In Unreal Engine 5 (Tutorial)

  Рет қаралды 31,164

Matt Aspland

Matt Aspland

Күн бұрын

Пікірлер: 85
@unrealdevop
@unrealdevop 11 ай бұрын
I really wish the widget system would be given Native Keybinding support. I just feel like the way they handle input actions for Widgets needs a serious overhaul.
@Punisher1992
@Punisher1992 6 күн бұрын
If you know how it works, its really really easy, and "CommonUI" made it so much easier. i had no issues to just set up my widget and it worked with controller out of the box.
@Yorgarazgreece
@Yorgarazgreece Жыл бұрын
This is a simple solution to a problem that may work 90% of the time but it is not modular enough. For example if you want to allow the user to remap the inventory key, you can't do that this way, unless you have a configurable variable which will be different from the input mapping context. Generally a better (IMO) idea would be to handle the interaction from where you trigger the inventory event. That being said, if you want to handle inventory access in all characters, i guess you could place it in player controller - or - an even better approach would be to create an actor component, call it "WithInventoryAccess" & attach "WithInventoryAccess" component to any characters you want them to have access to the inventory. I think you guessed already that I am a big fan of the enhanced input system in 5.1 :P That being said, that's one clever way to solve a problem if you don't mind modularity. Kudos to that!
@MirrorsEdgeGamer01
@MirrorsEdgeGamer01 Жыл бұрын
You can now use input events inside an actor component.
@Helgrind44
@Helgrind44 6 ай бұрын
The way I do it is that I implement a player pawn that I possess when the player is using the UI. That player pawn handles the IMC and the inputs. I then create an event dispatcher for each input. In my widget, I use get player pawn, cast it to my pawn, and then bind the created events. I'm not sure this is the cleanest way, but at least you can remap the keys through your IMC.
@Rukhd4Games
@Rukhd4Games Жыл бұрын
I think I found a way to use this with the enhanced inputs and be remappable / non-context specific. First get a reference to the enhanced input local player subsystem, then 'query keys mapped to action' for the specific action you want. That returns an array of keys mapped to the specific action. Then loop over the array checking if the key down equals one of the keys mapped to the action you are checking. I added a local bool to hold the result. Then branch and handle after that.
@ChanceBrunton
@ChanceBrunton Жыл бұрын
This is exactly what I was looking for, thank you! I didn't realize you could just get the subsystem and query it. Instead of using a loop, however, I used the "contains" node to check if they key event was in the array, which saves using a bool and seems to work well.
@rogerfoster8020
@rogerfoster8020 11 ай бұрын
I know its a bit of a necro but more people should be talking about this. While its a bit more messy it uses the IA system the way it should be used. That way the user can easily change keys without finding weird bugs like the video above suggested. Thank you!
@ryanjdev87
@ryanjdev87 10 ай бұрын
When I use the Array Contains Its returning a bool value, how does this save using a bool ? u still have to loop the array return to get the key structure it seems like to me@@ChanceBrunton
@mh518
@mh518 7 ай бұрын
@@ryanjdev87 why would you get the key structure? you only want to know if the pressed key is one of the assigned keys to the input action you want triggered, so when the bool is true you simply implement whatever you want to be done when the key is pressed.
@boggledeggnoggler5472
@boggledeggnoggler5472 5 ай бұрын
This worked for me!
@alexrybin3798
@alexrybin3798 7 ай бұрын
I'm stuck exactly for this issue. Why we can't use Key bindings in Widget is a mystery for me. thanks a lot for the tutorial.
@gamersbyknight9515
@gamersbyknight9515 Жыл бұрын
How did you make InputAction Inventory?
@tastysnak
@tastysnak Жыл бұрын
This is pretty neat, and works with the new enhanced input system too!
@colonelb
@colonelb Жыл бұрын
Hey Matt great stuff, but I have a question. Have you played w/ using the new 5.1 Input Mapping Contexts for this? I was playing with having TWO contexts: one for game, and one for UI, and then rather than setting the mode to "UI Only" I set it to "Game and UI" and then remove the game input context and add the umg input context. (And then when the widget/menu is closed I reverse the process). Doing the Game and UI mode DOES fire the Input actions in the widget (It just doesn't if you're in UI only mode), so by swapping mapping contexts it's sort of a cheat to get a set of unique inputs into UMG. I've done a Proof-of-concept w/ this and it works but I don't know if there are any gotchas or if this a bad idea for some reason I don't know, so was wondering if you've tried that or have any thoughts on it? Cheers.
@MattAspland
@MattAspland Жыл бұрын
Interesting idea, I haven’t tried that myself but it sounds great! I think you are definitely utilising it how Unreal planned, so great work. As of right now I can’t think of any “gotcha’s” with this system, other than maybe making sure you’re always changing the mapping context of the correct player controller. Nice work!
@dimokol
@dimokol Жыл бұрын
Thanks so much for this 🙏
@tacolover619
@tacolover619 Жыл бұрын
Save our eyes. Please Disable Motion Blur :) 1. Go to the "Settings" > "Project Settings" > "Rendering" > "Post Processing" 2. Uncheck the "Motion Blur" option and Save/Rebuild lighting
@MattAspland
@MattAspland Жыл бұрын
I think it was more my recording than motion blur - but noted!
@Zeryphim
@Zeryphim 5 ай бұрын
Hey, quick question, how would you go about setting this up if I was applying it to a differnt type of menu to instead use the mouse scroll wheel instead of the cursor?
@feraly7506
@feraly7506 4 ай бұрын
The OnKeyDown event won't trigger unless I am clicking and holding down on a button. Any idea why? Edit: I'm dumb and didn't watch the whole video, in case anyone else does the same thing, set "is focusable" to true!
@Xylot
@Xylot Жыл бұрын
OK this is great and everything, but what if you want the player to be able to remap those keys? How do you grab information from an Enhanced Input Action, such as its trigger keys/buttons?
@v3developments304
@v3developments304 Жыл бұрын
Create a subsystem that can hold key bindings
@learningdev1315
@learningdev1315 Жыл бұрын
I'm confused, I use inputs (old style and enhanced) in widgets, I've never had an issue. I feel like I'm missing something here.
@ShamaxGD
@ShamaxGD Жыл бұрын
Is it possible to use Enhanced (or casual) input instead? I have a complex system in my UI so with this method I will have to create a BIG stair of branches, which is not quite convinient
@georgearida4144
@georgearida4144 Жыл бұрын
For games like assassin’s creed and others when you open inventory, equipment , map or any widget the game paused , I usually call the function set game paused I haven’t seen any video mentioning that
@Starblendet
@Starblendet Жыл бұрын
I have a tutorial screen with text to pop up and remove it when the player press any key. This works with any keyboard or controller key but not with a mouseclick. I tried to override the function "OnMouseButtonDown" and copy the nodes but for some reason it doesnt trigger this override?!
@AdireetiVlogs
@AdireetiVlogs Жыл бұрын
hi error showing during packaging LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(954)]! Plz let me know how to fix the above error
@wojtekgaming6760
@wojtekgaming6760 Жыл бұрын
Any idea why the on key down node isn't receiving any input?
@DEM1GOD7
@DEM1GOD7 6 ай бұрын
Probably should let people know if you override a widgets function with a remove parent node, it will affect that WBP where ever it is. As in. Say you are using your inventory WBP for its purpose in game like that but you also, for what ever reason also use it from your mainmenu WBP. Pressing tab in there will also destroy the parent. In other words if anyone is watching this tutorial, its intended for a inventor WBP ONLY. dont use overrides if you are trying to get similar results for a ingame press escape key for a ingame menu system. Thought i should point that out for the timmys out there lol.
@srawdawg6188
@srawdawg6188 Жыл бұрын
Does anyone know where this map is from? Or what assets / packs were used to make it? Thanks
@boristrendafilov2243
@boristrendafilov2243 Жыл бұрын
Hi can you make a video on how to apply damage with spells like fire ball, lightning, explosions and other vfx?
@AlyrioNeto
@AlyrioNeto Жыл бұрын
Life saver as usual
@EvrenSaracgilArchitecture
@EvrenSaracgilArchitecture Жыл бұрын
Can i connect input key and widget button same thing? For example press ''p'' input key its pause and unpause game. When press p open ''pause menu'' it has ''continue'' widget button. I want, when press contiune button its activate input key ''p''.then unpause game again.
@BenskiGameWorks
@BenskiGameWorks 5 ай бұрын
Great video! I was trying to jsut get input normaly for more than an hour. Thank you
@carlosrivadulla8903
@carlosrivadulla8903 Жыл бұрын
I hope u bring us a way to do this with new mapping contexts
@solideogloria5553
@solideogloria5553 Жыл бұрын
you sir knows our noobs need, thank you for another excellent first class tut!
@pvtpinecone762
@pvtpinecone762 Жыл бұрын
Thanks for this! How do you hide the widget when the stamina = 100?
@roc6457
@roc6457 Жыл бұрын
It doesn't work with the arrow keys. With the rest it does. But I need to check if those specific keys are pressed.
@dasistwalter96
@dasistwalter96 Жыл бұрын
Yesss I needed this but couldn't find it anywhere. Thanks!
@MattAspland
@MattAspland Жыл бұрын
Glad I could help!
@makadi86
@makadi86 Жыл бұрын
ok what the purpose if I can close it normally from outside the widget!? and what If I want to remap the action keys
@MattAspland
@MattAspland Жыл бұрын
The example I gave in this video is just one example, people may want to use inputs in a widget for a variety of different reasons. And again, sometimes you don't have control of your other blueprints anymore to use the input there. This video is just a way for people to have an input detected in a widget, for whatever reason they want. Remapping the action keys would take different code, for example you could promote the value in the "==" to a variable and set this variable through an external blueprint which is linked to your key mappings.
@burakucpnar4965
@burakucpnar4965 Жыл бұрын
Hey Matt Can you make how to an inventory system please. like resident evil style or basic
@virtuaalruum
@virtuaalruum 3 ай бұрын
I am trying this to show main menu and pause game. At first I press P, all good... menu appears and pause work. I press P again to unpause... menu disappears but game is paused... I press one more time P and the game starts to play.... using UE5.3
@KGCofficial7
@KGCofficial7 Жыл бұрын
Another great tutorial bro! I've been here for a long while and it's literally awesome to see how far you've made it!
@MattAspland
@MattAspland Жыл бұрын
Thank you so much! I really appreciate it!
@chrischandras3390
@chrischandras3390 Жыл бұрын
Been looking for this functionality for weeks! Once again, can't thank you enough
@MattAspland
@MattAspland Жыл бұрын
Happy to help!
@PikBo100
@PikBo100 Жыл бұрын
i cant understand why, the input is changing back to game only but the widget is not closing from the screen ((
@MartKart8
@MartKart8 Жыл бұрын
looks fine to me the recording you did, I don't have 4K or the latest tv screen.
@PatrickTheDM
@PatrickTheDM Жыл бұрын
Very cool. The video is nice and crisp. I think what looks like lag is just motion blur in the engine or maybe that level is very demanding graphics wise. The sound seemed clearer as well.
@MattAspland
@MattAspland Жыл бұрын
Thanks for the feedback Patrick! Much appreciated! I’ve fine tuned my settings more tonight so hopefully next video is even better!
@ericdrob
@ericdrob Жыл бұрын
You're a legend
@agha809
@agha809 8 ай бұрын
Thank you! You're the best!
@aleca8910
@aleca8910 Жыл бұрын
Thank you, Matt! Yeah, I had the feeling this feature was designed for controllers only. You switch between input contexts (for gameplay and UI) and link input actions to different delegates/events. It's more limited but perhaps for the better. And about the video, it looks good on my screen.
@MattAspland
@MattAspland Жыл бұрын
It can be used for both PC and controller yep. Like you say, it has it's limitations - but there are use cases where you'd want it! Thanks for the feedback on the video too!
@aleca8910
@aleca8910 Жыл бұрын
@@MattAspland Sorry, English is not my first language. I could have put that better. When I mentioned controllers, I was referring to character controllers (or the character itself like you do). I think it's a great system and is better than the old one.
@MattAspland
@MattAspland Жыл бұрын
Ah right I get you, no worries!
@darkwolf780
@darkwolf780 Жыл бұрын
Quality wise looks good, it is a little laggy though
@MattAspland
@MattAspland Жыл бұрын
Thanks for the feedback, I think I may have some better settings now - we can see on my next upload!
@jrshe3330
@jrshe3330 Жыл бұрын
tnx for this is focusable... means a lot
@donhoolieo4896
@donhoolieo4896 Жыл бұрын
I was actually just thinking how I could accomplish this while chilling. I couldn’t figure it out from a theoretical standpoint, so I chalked it up to something I would cross when I get there in my game but your read my mind! Thank you my man! Cheers 🍻
@MattAspland
@MattAspland Жыл бұрын
Great to hear, happy to help!
@manasjoshi2939
@manasjoshi2939 Жыл бұрын
thanks for the awesome video🙌
@rifat.ahammed
@rifat.ahammed Жыл бұрын
Very informative. Thank you soo much
@MattAspland
@MattAspland Жыл бұрын
My pleasure!
@raconte-moiunehistoire756
@raconte-moiunehistoire756 Жыл бұрын
I had the issue that when I clicked anywhere when the widget was opened, no input would work anymore, and I couldn't close the widget. To avoid this problem, you need to go to your Canvas Panel in the Designer, and set the visibility to "Visible" instead of "Not Hit-Testable".
@pabloa4672
@pabloa4672 Жыл бұрын
this is just right for my game and with fewer steps than my code. Thank you!
@MattAspland
@MattAspland Жыл бұрын
Perfect!
@mrbah7462
@mrbah7462 Жыл бұрын
Thanks a lot for your works
@Nexus-Point
@Nexus-Point Жыл бұрын
This doesn't work for me for some reason, A little help? It's pretty much the same as the one you made in the video
@KratonWolf
@KratonWolf Жыл бұрын
I've been trying to find a tutorial for how to use key bindings to select and switch between onscreen widget components within a widget (for instance if not using a mouse at all, and using arrow keys or joystick to go up/down/left/right selecting options and enter key or A button to confirm the selection), but I haven't had much luck in finding something like that. It would be awesome if you had a tutorial for how to do that, because in my opinion yours are the best and easiest tutorials to follow.
@thelostsoul9497
@thelostsoul9497 Жыл бұрын
Only shows to switch between Game Mode and Widget. Still doesn't show how to use keys to navigate inside of Widgets
@nick_the_octopus
@nick_the_octopus Жыл бұрын
Thank you!
@안성훈-g2e
@안성훈-g2e Жыл бұрын
So Thank, UserWidget Input
@YugesBoys
@YugesBoys 11 ай бұрын
inventory wont close.
@onebuckgames
@onebuckgames Жыл бұрын
Actually I didn't see any difference between this way of recording and the old one. But if it works for you then keep it.
@budpeetie6879
@budpeetie6879 Жыл бұрын
Vid is little laggy on the phone, will check on pc.
@gamerdweebentertainment1616
@gamerdweebentertainment1616 Жыл бұрын
No fking way, finally. Will check it out later, proba ly something obvious again and I was lazy to trt even
@ArtofWEZ
@ArtofWEZ Жыл бұрын
Thankyou
@b4ttlemast0r
@b4ttlemast0r Жыл бұрын
seems to be pretty laggy ingame
@MattAspland
@MattAspland Жыл бұрын
That's just my recording settings, it was running smoothly for me - it just didn't get recorded as smooth. I'm working on those settings now and I think I've fixed it.
@aasia-khan
@aasia-khan 6 ай бұрын
blurred screen!
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
The Art of Game Optimization
10:18
Worlds In Motion
Рет қаралды 279 М.
Unreal Engine 5 - How to use LIST VIEW inside widgets
9:06
UntitledProjectX
Рет қаралды 1 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 130 М.
The Common UI Plugin is AMAZING! This is How it Works
12:15
The Game Dev Cave
Рет қаралды 47 М.
How to Make UI in Figma and Use In Unreal Engine 5
9:56
Gabrielle Snow
Рет қаралды 21 М.
How To Use MegaLights Tutorial - Unreal Engine 5.5
9:31
Smart Poly
Рет қаралды 37 М.
How to create Modular and Scalable UI systems in Unreal Engine
19:15
AmrMakesGames
Рет қаралды 100 М.
I Struggled With Blueprint Interfaces for Years!! (Unreal Engine 5)
16:48
Glass Hand Studios
Рет қаралды 194 М.
Key Mappings in Unreal Engine 5.3 Enhanced Input System
13:59
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН