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

  Рет қаралды 25,772

Matt Aspland

Matt Aspland

Күн бұрын

Hey guys, in today's video I'm going to be showing you how to use your input buttons inside of a widget blueprint. If you want to do some code after the player presses "E" in a widget for example, this video is perfect for you!
Get access to the project files from my videos and more on my Patreon: / mattaspland
#UE5 #UnrealEngine5 #UE5Tutorial
___________________________________________________________________________
00:00 - Intro
00:18 - Overview
00:49 - New Recording Settings
01:09 - Tutorial
06:16 - Final Overview
06:24- Outro
___________________________________________________________________________
If you enjoy make sure to subscribe: / @mattaspland
Join My Discord Server: / discord
Follow Me On Twitter: / matt_aspland
Follow Me On Instagram: / matt_aspland_
All My Social Media Links: linktr.ee/MattAspland
___________________________________________________________________________
If you want to support me, there are many different ways of doing so. This is by no means expected or required. It is just a nice support :)
Patreon: / mattaspland
PayPal: paypal.me/mattaspland?country...
Ko-Fi: ko-fi.com/mattaspland
Thank you :)
___________________________________________________________________________
To access the project files and screenshots from the video, check out my Patreon above!
My Public Video List: trello.com/b/7vJgXzBm
Unreal Engine 4 Tutorials Playlist: • Unreal Engine 4 Tutorials
The Basics Of Nodes Playlist: • The Basics Of Nodes In...
___________________________________________________________________________
♫Outro Song♫
●Kronicle - Chill Noons

Пікірлер: 77
@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 6 ай бұрын
You can now use input events inside an actor component.
@Helgrind44
@Helgrind44 4 күн бұрын
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.
@unrealdevop
@unrealdevop 5 ай бұрын
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.
@itsbogtime
@itsbogtime Жыл бұрын
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!
@tastysnak
@tastysnak Жыл бұрын
This is pretty neat, and works with the new enhanced input system too!
@AlyrioNeto
@AlyrioNeto 10 ай бұрын
Life saver as usual
@chrischandras3390
@chrischandras3390 Жыл бұрын
Been looking for this functionality for weeks! Once again, can't thank you enough
@MattAspland
@MattAspland Жыл бұрын
Happy to help!
@manasjoshi2939
@manasjoshi2939 Жыл бұрын
thanks for the awesome video🙌
@rifat.ahammed
@rifat.ahammed Жыл бұрын
Very informative. Thank you soo much
@MattAspland
@MattAspland Жыл бұрын
My pleasure!
@mrbah7462
@mrbah7462 Жыл бұрын
Thanks a lot for your works
@keithcollier4860
@keithcollier4860 Жыл бұрын
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 5 ай бұрын
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 5 ай бұрын
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!
@ryanjdevlin87
@ryanjdevlin87 4 ай бұрын
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 Ай бұрын
@@ryanjdevlin87 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.
@agha809
@agha809 2 ай бұрын
Thank you! You're the best!
@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!
@jrshe3330
@jrshe3330 9 ай бұрын
tnx for this is focusable... means a lot
@thebigchair8584
@thebigchair8584 Жыл бұрын
Thank you!
@ericdrob
@ericdrob Жыл бұрын
You're a legend
@pabloa4672
@pabloa4672 Жыл бұрын
this is just right for my game and with fewer steps than my code. Thank you!
@MattAspland
@MattAspland Жыл бұрын
Perfect!
@dasistwalter96
@dasistwalter96 Жыл бұрын
Yesss I needed this but couldn't find it anywhere. Thanks!
@MattAspland
@MattAspland Жыл бұрын
Glad I could help!
@solideogloria5553
@solideogloria5553 Жыл бұрын
you sir knows our noobs need, thank you for another excellent first class tut!
@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!
@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 10 ай бұрын
Thanks so much for this 🙏
@gamersbyknight9515
@gamersbyknight9515 9 ай бұрын
How did you make InputAction Inventory?
@pvtpinecone420
@pvtpinecone420 Жыл бұрын
Thanks for this! How do you hide the widget when the stamina = 100?
@ShamaxGD
@ShamaxGD 6 ай бұрын
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
@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!
@carlosrivadulla8903
@carlosrivadulla8903 Жыл бұрын
I hope u bring us a way to do this with new mapping contexts
@boristrendafilov2243
@boristrendafilov2243 Жыл бұрын
Hi can you make a video on how to apply damage with spells like fire ball, lightning, explosions and other vfx?
@user-dm5uj1mh6z
@user-dm5uj1mh6z 8 ай бұрын
So Thank, UserWidget Input
@ArtofWEZ
@ArtofWEZ Жыл бұрын
Thankyou
@srawdawg6188
@srawdawg6188 9 ай бұрын
Does anyone know where this map is from? Or what assets / packs were used to make it? Thanks
@burakucpnar4965
@burakucpnar4965 Жыл бұрын
Hey Matt Can you make how to an inventory system please. like resident evil style or basic
@MartKart8
@MartKart8 Жыл бұрын
looks fine to me the recording you did, I don't have 4K or the latest tv screen.
@alexrybin3798
@alexrybin3798 Ай бұрын
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.
@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 6 ай бұрын
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?!
@alanh7285
@alanh7285 Жыл бұрын
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!
@wojtekgaming6760
@wojtekgaming6760 Жыл бұрын
Any idea why the on key down node isn't receiving any input?
@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
@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.
@DEM1GOD7
@DEM1GOD7 4 күн бұрын
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.
@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.
@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.
@AdireetiVlogs
@AdireetiVlogs 6 ай бұрын
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
@gamerdweebentertainment1616
@gamerdweebentertainment1616 Жыл бұрын
No fking way, finally. Will check it out later, proba ly something obvious again and I was lazy to trt even
@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!
@raconte-moiunehistoire756
@raconte-moiunehistoire756 9 ай бұрын
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".
@PikBo100
@PikBo100 8 ай бұрын
i cant understand why, the input is changing back to game only but the widget is not closing from the screen ((
@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.
@thelostsoul9497
@thelostsoul9497 9 ай бұрын
Only shows to switch between Game Mode and Widget. Still doesn't show how to use keys to navigate inside of Widgets
@KratonWolf
@KratonWolf 11 ай бұрын
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.
@Nexus-Point
@Nexus-Point 9 ай бұрын
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
@YugesBoys
@YugesBoys 4 ай бұрын
inventory wont close.
@budpeetie6879
@budpeetie6879 Жыл бұрын
Vid is little laggy on the phone, will check on pc.
@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.
@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.
I Made a Game With Only FREE Assets In Unreal Engine 5
11:45
Smart Poly
Рет қаралды 472 М.
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 34 МЛН
Must-have gadget for every toilet! 🤩 #gadget
00:27
GiGaZoom
Рет қаралды 7 МЛН
Watermelon Cat?! 🙀 #cat #cute #kitten
00:56
Stocat
Рет қаралды 42 МЛН
How to Make UI in Figma and Use In Unreal Engine 5
9:56
Gabrielle Snow
Рет қаралды 15 М.
Float Menu X - Unreal Engine 5 - Tutorial
9:55
Risecode
Рет қаралды 12 М.
I Struggled With Blueprint Interfaces for Years!! (Unreal Engine 5)
16:48
Glass Hand Studios
Рет қаралды 172 М.
Making UIs With C++ in Unreal Engine, by Ben UI
32:40
JetBrains
Рет қаралды 20 М.
How to create Modular and Scalable UI systems in Unreal Engine
19:15
Common UI Input system in Unreal Engine 5
5:54
Volkiller Games
Рет қаралды 23 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 92 М.