How To Use The New Enhanced Input Action Mappings In Unreal Engine 5.1 (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another Unreal Engine 5 tutorial so in today's video we're gonna be going over is a new enhanced input action mapping system inside of Unreal Engine 5.1 and Beyond so as you may have noticed if you've updated Unreal Engine 5.1 the normal action mappings and axis mappings and all that are now deprecated and they've been replaced with a new enhanced input Action System now this can be a little bit confusing just to wrap your head around but once you do understand it you'll notice this is actually very very powerful and a lot better than the old system which is why we're going to be going over how to use it today now today I'm just creating a very basic system of creating a flashlight using this now all I'm doing is turning the light on and off just to show you how these action mappings work so if I just hit play we can see that by holding F I'm going to turn it on releasing F I'm going to let go I'm going to turn it off again sorry let me just turn it on and off like this so this is what we're going over and creating today so without further Ado let me delete this code and I'll show you how I've done it so what we're going to do first is I'm just going to show you the old version versus the new version so if you go to edit project settings if you go down to input this is obviously where it used to be so we have our action wrappings and axis mappings you can still add these and I believe they do probably still work but we'll see they're not the good versions to use anymore so you'll notice here it says axes and action mappings are now deprecated please use enhanced input actions and input mapping context instead now in the engine we also now have enhanced input here this isn't what we're going to be using however you'll notice we have all these different like we have all the different platforms here but this isn't where we do it we don't do it in the project settings anymore so we're going to close that I'm just going to show you that quick thing what we're going to do is open up our content browser I've created a new folder called input so I'm just going to put it in here and we're going to right click go to input in here so we have input and we're going to create an input action so I'm going to name this IA for input action then underscore flashlight as this is what I would name my action mapping I would just call it flashlight so I'm putting IA for input action then flashlight then we're going to open it up straight away now this may look fairly similar to before so before when you created an action wrapping and got it inside of your event graph and your blueprint if you were to select it you may get something that looks like this come up on the right hand side so consume input we can obviously see if it consumes the input so nothing else will work with this or if you want it to trigger and pause resolve mappings all this great stuff we do that inside of this blueprint instead we can also change the value type so it's a Boolean flow negative 2D or vector I'm just going to leave it as a digital pool for the moment for this one if I don't need to worry about it and the triggers and modifiers I'm also not going to add on here obviously you can add one and see what these are so you've got corded action combo down hold on release and if you hover over these you get all these different descriptions of what they do as well so hold and release trigger fires when input is released after having been actuated for at least whole time threshold seconds so basically what all of this means is before if we wanted to do custom things with our input actions we had to do ourselves so if we wanted to something to happen when holding it down we'd have to set that up ourselves using delays and loops and all that stuff but now we can just do it with halt this basically means it's going to be able to do it for us so we don't need to do everything ourselves which is why it's a much better system and the same with modifiers you can click on it hover over these to see them all again like this but for me this is just all gonna be fine by default then I'm going to save that and close it the next thing we want to do is go back to our content browser right click go back to input and create an input mapping context so we've created input action now we need our input mapping so we can actually map to that input so we're going to create that and I'm just going to name this my game input mapping or IM and then the name of your game or whatever it is that you want to do I'm going to open it up straight away now this should also look fairly familiar because this Chanel just looked like your edit project settings input that we had before so if you're to press add action mapping again this is where it looks similar so you can choose what it's going to be so instead of naming it here you choose your interaction so we've got flashlights and then you just choose the key you want or I can press this here and then press f as I want it to be on the F key for flashlights and you can again do triggers and modifiers in here is player mappable so if true then it is action key mapping will be exposed as a player mappable key basically meaning the player can change it so the player can map it and obviously if you tick that then you have access to the options for it but I'm not going to be going for that in this video however I will probably make a video on that in the future it's just obviously something more advanced so we don't need to do it in this video right now but again that's all we need to do so we've got our input action and we've got the key we're going to use to fire off that input action so we're going to save this and close it and I should say all of this is also the same if you're doing axis mappings you'd obviously just if I had to open the input action here instead of the value type being digital you'd use axis 1D float so then you can also use one and minus one to go forwards and backwards like we used to before but again today's video I'm just doing a flashlight with an action mapping not an axis mapping but it's very very similar so we're going to close those and now we're going to open up our player blueprints to actually use this action mapping so obviously it doesn't have to be your player blueprint but that's where it's going to be for me as it's a flashlight so in here you might have noticed this is a little bit different as well as I'll see they're now using the new enhanced system so what they're doing for the camera input is you can see here this is what they're going to look like but we're going to go over it more soon so you've got left right up down and you'll notice all of this just looks a lot cleaner and a lot more efficient and it's just better connected and it runs a lot better and obviously we have more options and control over it all as well so on event begin to play what they're doing is they're adding the input mapping so they're casting to the player controller to get the correct player controller then getting that enhanced input local player subsystem and then they're adding the mapping context to that so essentially what we're doing is just apping the mapping context to the player controllers enhanced input subsystem and the enhanced input subsystem is again a part of this new enhanced input mappings that we need to be able to use now you'll notice again they've already added one on here however you can have multiple mapping contexts for one local subsystem so I'm going to be doing that as well just to show you so I have to come out of the enhanced input local player subsystem or what I'm going to do is just call this root node I can then do add mapping context once again like they've got I'm just going to connect that into the end here so it's going to be fired off of event begin play as well when the rest of this code is doing it if you don't add in the mapping context you're obviously not going to be able to use your input actions it's just not going to work it won't fire off as you haven't specified the player can actually use those input actions the mapping context is obviously going to be the one we just created which I named mind game input mapping obviously IMC default is the one they are using so you may want to just use that one as well so it's all in one like so so we're going to select that we'll compile and save that and now what we can do is if we find some empty space we can right click and search for our input action so I need mine IA flashlight you'll notice we now have the Ia flashlight under the enhanced action events now again you'll notice we've got lots of different values on here it just makes it a lot more efficient so I'm going to be going over what these are so started is essentially pressed and completed is essentially released so those are the main two you're going to need started and completed are pressed and released so if I were to just get a print string on these we've got pressed and then if I do that I'm completed as well we'll get released and this is also how I found out what they will do I just put print strings on press the button see what they did and when so I can then press F you've got pressed released like so working perfectly like this so if I just hold it down press Let Go released so those are the main two we're going to need triggered is essentially going to be firing off when you're holding it down so if I were to get print string here and get hold or held what we're going to do hold it down it's going to be saying hold like so that's just gonna be firing off throughout the duration that we are holding down the button which again is a much better way of doing hold down interactions instead of how we used to be able to do it before now ongoing and canceled offer something different if you hover over it it says triggering is still being processed and triggering has been canceled so this I believe is for when you're adding different triggers and modifiers in the actual input action itself that's what these are going to be used for and obviously the elapse seconds triggered settings and input action obviously pretty self-explanatory as well again if you hover over all of these you get more details too but we're just gonna be creating a basic flashlight like I say so we're going to need pressed and released or I should now say we're going to need started and completed what I'm going to do first is just go to my viewport and obviously add in a quick Spotlight so we actually have a quick flashlight here putting the intensity all the way up just so we can see it in this bright level if I just drag this in what we're going to do is add this set visibility putting that into started so when we hold it down it's going to be new visibility and then off if completed we're going to set visibility again over completed like I say setting it to false so when we then let go we're going to be setting it back to false so turning the light off so when we press it we're turning on when we release it we're turning it off and obviously if you want to do a flip-flop so you toggle it on and off you just get a flip-flop out of started so out of pressed so again it's very very similar to how we used to do it before it's just some of the names have changed and we've just got more details and more control over it as well kind of similar to how they changed up the animation retargeting system it's very similar we just now have more control over it and we can do a lot more stuff it's a lot more efficient and it's just better all round so I also need to do is make sure that my flashlight is off by default so my search visibility like so now if we compile and save this what we see is if we to test this out hold down F our flashlight's on release F it's turned off again so we now have our own input action mapping fully set up and working so we have our flashlight system like so so I think that'll be it for this video as we've done everything we want to do what we've done is we've gone over setting up our own input action mappings and our mapping context for the new enhanced input mapping system with Unreal Engine 5.1 and later and doing this we've just created a very basic flashlight system just to turn it on and off but we've just done that to show how the input actions now work so thanks so much for watching this video I hope you enjoyed it and I hope found it helpful and if you did please make sure to like subscribe down below so thanks so much for watching and I'll see you in the next one [Music]
Info
Channel: Matt Aspland
Views: 47,413
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, blender, unity, games design, ue5, unreal engine 5, unreal engine 5 tutorial, ue5 tutorial, enhanced, input, action, mappings, mapping, system, axis, ue5 enhanced action mapping, ue5.1, 5.1, new, enhanced input, plugin, how to use
Id: nXJuXUxQfa8
Channel Id: undefined
Length: 11min 5sec (665 seconds)
Published: Tue Nov 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.