UE5 Enhanced Input C++ Setup! | Unreal Engine 5 Tutorial

  Рет қаралды 22,376

Shawnthebro

Shawnthebro

Күн бұрын

Have you ever wondered how to implement Enhanced Input in a project with C++ and Blueprints? Wonder no longer! In this episode, I go over setting up Input Mapping Context objects, customizing InputActions, and pairing bindings made in the code with characters made in Blueprints.
Enhanced Input is a new form of input developed for Unreal Engine 5.1 and higher. This new input system can handle some of the more complicated mechanics with input actions and input axes, such as charged inputs, held versus tap inputs, as well as deadzones and response curves. It is not required to implement Enhanced Input as of the current time over standard Action Mappings and Axis Mappings.
Thanks for watching my video. Please let me know your thoughts and feel free to reach out to me!
OTHER PROGRAMMING VIDEOS:
► Super Smash Brothers Tutorial (Part #1): • How To Make YOUR OWN S...
► Third-Person Action Tutorial (Part #1): • How To Make YOUR OWN T...
► First-Person Shooter Tutorial (Part #1): • How To Make YOUR OWN F...
► Action RPG Tutorial (Part #1): • How To Make YOUR OWN A...
► Custom Horror Game Camera (Camera Lag): • Smooth Camera Movement...
► Download & Importing FREE Assets From Mixamo: • How To Import FREE Mix...
► Unreal Engine and Source Control (Perforce) Tutorial (Part #1): • How To Use SOURCE CONT...
JOIN MY CHANNEL:
► / @shawnthebro
FOLLOW MY OTHER CHANNELS:
► Shawnthebro27 (My Gaming and Livestream Archive Channel): / @shawnthebro27
A HUGE THANKS TO:
► Character Avatar: David Marshall (MalthaelsMight).
► Intro Video: Pedro J. Burgos (@Shadow_Magnus).
► Music: Mitchell Hartwell.
CONNECT WITH ME:
► Facebook: / shawnthebro
► Twitter: / shawnthebro
► Instagram: www.instagram....
► Twitch: / shawnthebro27
► LinkedIn: / spkylerii
► Patreon: / shawnthebro
► Discord: / discord
► Tumblr: / shawnthebro
► My Website: shawnthebro.com/
PLAY MY GAMES:
► Bad Manors: www.kongregate...
► Fury Strike: 80s Beatdown: store.steampow...
#HowToMakeAFightingGame #StreetFighter #Unreal #MakingAFightingGame #UnrealEngine #UnrealEngine4 #UnrealEngine5 #UnrealTutorial #UE4 #UE5 #Tutorial #EnhancedInput #Shawnthebro #STB

Пікірлер: 50
@Fightarcade
@Fightarcade Жыл бұрын
I tried on FighterTemplate in UE5.2, but it worked👍✨!
@Shawnthebro
@Shawnthebro Жыл бұрын
Excellent news! Thank you for letting me know!
@torarinvik4920
@torarinvik4920 5 ай бұрын
Awesome. One tip use forward declaration in the header and include in the cpp file. This speeds up compilation times afaik.
@Shawnthebro
@Shawnthebro 5 ай бұрын
Thank you very much! That is a great tip, and I believe you are correct. I don’t do it often, but I will do my best to use forward declarations in the future!
@julianaskuratovsky8701
@julianaskuratovsky8701 4 ай бұрын
thank you very much!! wonderful tutorial!!
@Shawnthebro
@Shawnthebro 4 ай бұрын
It is my pleasure! I’m so glad you enjoyed!
@jekku9
@jekku9 7 ай бұрын
I needed to also add #include "InputMappingContext.h" in the header file to get it to compile
@Shawnthebro
@Shawnthebro 7 ай бұрын
Thank you for the tip! The next few Unreal Engine versions (5.0-5.3) had minor changes to things like this. This is goo to know for people who may run into this issue.
@deanmiller541
@deanmiller541 6 ай бұрын
What's the purpose of the Input Mapping Context field in your pawn? It seems like it isn't referred to in your C++ code.
@Shawnthebro
@Shawnthebro 6 ай бұрын
Yes! You are correct. I had actually set it in the Blueprint in the previous Enhanced Input episode. I should have shown the line of code in this one, but I forgot. The point of the context is to assign the mappings and allow the system to capture them when the player inputs them. Here is the line you should use to do it in C++ code: APlayerController* controller = Cast(GetController()); UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem(controller->GetLocalPlayer()); Subsystem->AddMappingContext(inputMappingContext, 0);.
@RonGameDev
@RonGameDev 11 ай бұрын
When you cast to the Enhanced input component, could I also just change the function? Instead of "...::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)" could I do something like "...::SetupPlayerInputComponent(class UEnhancedInputComponent* PlayerInputComponent)"?
@Shawnthebro
@Shawnthebro 11 ай бұрын
That is a good call. You absolutely can do that (Unreal changes the code to use this method after 5.2). You may need to change the source code as well if you do this, since SetupPlayerInputComponent comes from the Character class (parent of our base character).
@noname_2108
@noname_2108 7 ай бұрын
hey there, thanks for the tutorial! BUT, for some reason when a create a blueprint based on the c++ class of a character and assign there an Action it is nullptr in the game and my mapping context doesn't work. Can you tell why?face-red-droopy-eyes
@Shawnthebro
@Shawnthebro 7 ай бұрын
Hello! I’m glad you enjoyed. The Mapping Context needs to be assigned in the code or Blueprint. Do you know if this was done? If not, I will gladly share what you need.
@noname_2108
@noname_2108 7 ай бұрын
@@Shawnthebro yes, firstly I didn’t add context for a enhanced input subsystem and for some reason when I switched the game mode to default action stopped being nullptr
@noname_2108
@noname_2108 7 ай бұрын
@@Shawnthebro so that’s it, no it’s all good
@Shawnthebro
@Shawnthebro 7 ай бұрын
Good catch! Nice working finding it.
@Shawnthebro
@Shawnthebro 7 ай бұрын
Very good news!
@S.Gamedev-zc2wp
@S.Gamedev-zc2wp 11 ай бұрын
I wait for next tutorial
@Shawnthebro
@Shawnthebro 11 ай бұрын
Thank you very much! I hope you enjoy it when you see it!
@lubospejchal498
@lubospejchal498 Жыл бұрын
How to bind movement action to character by c++ code (Character.cpp)? I mean without blueprint of character.
@Shawnthebro
@Shawnthebro Жыл бұрын
This is a good question! There is some combination of the C++ and Blueprints in this episode. You can do it without Blueprints by creating these EnhancedInputAction classes (inputToJump and inputToMove classes) and assign them to the pointers in the character. That will eliminate the need to set them in the Blueprint.
@jrkienle
@jrkienle 5 ай бұрын
@@Shawnthebro Is there any chance you can elaborate on this a bit more? I'm trying to move over from the web dev to game dev industry and trying to stick to C++ instead of blueprint wherever possible to have better git difs. If you have any links to docs on assigning those C++ pointers in Unreal Engine I'd love to see them!
@Shawnthebro
@Shawnthebro 5 ай бұрын
Absolutely! C++ knowledge is very helpful. You’d like to assign the pointers in C++ for the mappings instead of the CharacterBP, is that correct?
@unrealengine5-storm713
@unrealengine5-storm713 11 ай бұрын
InputComponent is always null for clients and idk wtf to do
@Shawnthebro
@Shawnthebro 11 ай бұрын
Are you handling the InputComponent in the Character class (like in this video) or in a PlayerController class?
@unrealengine5-storm713
@unrealengine5-storm713 11 ай бұрын
@@Shawnthebro The player controller. I imagine this is where my issue arises but I don't understand how or why this matters. :(
@Shawnthebro
@Shawnthebro 11 ай бұрын
In my opinion, the PlayerController is the better place to do it (it at least makes more sense). I think it might be causing an issue because there isn’t a proper PlayerController assigned to the client, or they aren’t set up to use your custom PlayerController. Do you know if that is the case?
@punchline1729
@punchline1729 Жыл бұрын
👌 👌
@Shawnthebro
@Shawnthebro Жыл бұрын
Thank you so much! I’m glad you enjoyed.
@halfbakedproductions7887
@halfbakedproductions7887 7 ай бұрын
My favourite part about Unreal is how it doesn't play nice with Visual Studio and won't compile code that's correct, because it whines like a bitch about not being able to find header files. Rebuild and clean your project between 17 and 44 times while wearing a blonde wig and it might work. You won't know why it now works, but you shouldn't question or jinx it.
@Shawnthebro
@Shawnthebro 7 ай бұрын
Make sure the editor is closed when building Visual Studio if it is giving you trouble. Sometimes both programs try to access the same file at the same time, which isn't possible.
@Vundeq
@Vundeq 11 ай бұрын
cannot open source file "InputAction.h" :(
@Shawnthebro
@Shawnthebro 11 ай бұрын
Sometimes there are IntelliSense errors when adding new includes. Have you tried building? If so, does the Output Log give any additional information on the error?
@brainfox8393
@brainfox8393 8 ай бұрын
@@Shawnthebro D:\UnrealProjects\BirdFly\Source\FlappyBird\Public\Bird.h(5): fatal error C1083: Cannot open include file: 'InputAction.h': No such file or directory i also have this problem
@Shawnthebro
@Shawnthebro 8 ай бұрын
Are you in UE5.0 or UE5.1 and higher?
@brainfox8393
@brainfox8393 8 ай бұрын
@@Shawnthebro 5.2,I have solved this problem through adding EnhancedInput Module ,it seems that it must add module before add include
@Shawnthebro
@Shawnthebro 8 ай бұрын
Good find! I'll make a note for 5.2 (and probably higher).
@GoldnTouch448
@GoldnTouch448 Жыл бұрын
can you make a fighting game tutorial for ue5
@Shawnthebro
@Shawnthebro Жыл бұрын
Yes! The current Fighting Game Tutorial series will be converted to UE5 after a few issues with rollback netcode in UE5 are resolved.
@GoldnTouch448
@GoldnTouch448 Жыл бұрын
@@Shawnthebro thank you I've been struggling for awhile
@Shawnthebro
@Shawnthebro Жыл бұрын
No worries, my friend!
@apalladium5k
@apalladium5k Жыл бұрын
Good work, Thanks for the walkthrough!
@Shawnthebro
@Shawnthebro Жыл бұрын
Thank you very much! I’m glad you enjoyed.
@S.Gamedev-zc2wp
@S.Gamedev-zc2wp 11 ай бұрын
i love you
@Shawnthebro
@Shawnthebro 11 ай бұрын
I am very happy about your kind words. Thank you so much!
Getting into C++ with Unreal Engine - Part1 - Setting up
34:49
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 3,1 МЛН
UE5 C++ Enhanced Input - 5 - Directional Input to Move a Character
39:42
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
Easy Version Control for Unreal Engine 5 - Diversion Tutorial
13:38
10 Unreal Engine 5 PLUGINS I can't live without!
9:37
Cinecom.net
Рет қаралды 547 М.
UE5 C++ Enhanced Input - 2 - Bind C++ Functions to Input Actions
51:44
Druid Mechanics
Рет қаралды 67 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 114 М.
How to use Enhanced Input in Unreal Engine C++
11:40
Acromata
Рет қаралды 4,9 М.
Getting into C++ with Unreal Engine - Part4 - Enhanced Input
42:21