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

  Рет қаралды 18,404

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: shawnthebro...
► Twitch: / shawnthebro27
► LinkedIn: / spkylerii
► Patreon: / shawnthebro
► Discord: / discord
► Tumblr: / shawnthebro
► My Website: shawnthebro.com/
PLAY MY GAMES:
► Bad Manors: www.kongregate.com/games/Yugi...
► Fury Strike: 80s Beatdown: store.steampowered.com/app/89...
#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!
@apalladium5k
@apalladium5k 10 ай бұрын
Good work, Thanks for the walkthrough!
@Shawnthebro
@Shawnthebro 10 ай бұрын
Thank you very much! I’m glad you enjoyed.
@julianaskuratovsky8701
@julianaskuratovsky8701 Ай бұрын
thank you very much!! wonderful tutorial!!
@Shawnthebro
@Shawnthebro Ай бұрын
It is my pleasure! I’m so glad you enjoyed!
@torarinvik4920
@torarinvik4920 2 ай бұрын
Awesome. One tip use forward declaration in the header and include in the cpp file. This speeds up compilation times afaik.
@Shawnthebro
@Shawnthebro 2 ай бұрын
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!
@jekku9
@jekku9 3 ай бұрын
I needed to also add #include "InputMappingContext.h" in the header file to get it to compile
@Shawnthebro
@Shawnthebro 3 ай бұрын
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.
@RonGameDev
@RonGameDev 8 ай бұрын
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 8 ай бұрын
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).
@S.Gamedev-zc2wp
@S.Gamedev-zc2wp 8 ай бұрын
I wait for next tutorial
@Shawnthebro
@Shawnthebro 7 ай бұрын
Thank you very much! I hope you enjoy it when you see it!
@deanmiller541
@deanmiller541 2 ай бұрын
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 2 ай бұрын
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);.
@punchline1729
@punchline1729 9 ай бұрын
👌 👌
@Shawnthebro
@Shawnthebro 9 ай бұрын
Thank you so much! I’m glad you enjoyed.
@lubospejchal498
@lubospejchal498 8 ай бұрын
How to bind movement action to character by c++ code (Character.cpp)? I mean without blueprint of character.
@Shawnthebro
@Shawnthebro 8 ай бұрын
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 Ай бұрын
@@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 Ай бұрын
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?
@noname_2108
@noname_2108 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
@@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 4 ай бұрын
@@Shawnthebro so that’s it, no it’s all good
@Shawnthebro
@Shawnthebro 4 ай бұрын
Good catch! Nice working finding it.
@Shawnthebro
@Shawnthebro 4 ай бұрын
Very good news!
@S.Gamedev-zc2wp
@S.Gamedev-zc2wp 8 ай бұрын
i love you
@Shawnthebro
@Shawnthebro 7 ай бұрын
I am very happy about your kind words. Thank you so much!
@unrealengine5-storm713
@unrealengine5-storm713 8 ай бұрын
InputComponent is always null for clients and idk wtf to do
@Shawnthebro
@Shawnthebro 8 ай бұрын
Are you handling the InputComponent in the Character class (like in this video) or in a PlayerController class?
@unrealengine5-storm713
@unrealengine5-storm713 8 ай бұрын
@@Shawnthebro The player controller. I imagine this is where my issue arises but I don't understand how or why this matters. :(
@Shawnthebro
@Shawnthebro 8 ай бұрын
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?
@Vundeq
@Vundeq 8 ай бұрын
cannot open source file "InputAction.h" :(
@Shawnthebro
@Shawnthebro 8 ай бұрын
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 5 ай бұрын
@@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 5 ай бұрын
Are you in UE5.0 or UE5.1 and higher?
@brainfox8393
@brainfox8393 5 ай бұрын
@@Shawnthebro 5.2,I have solved this problem through adding EnhancedInput Module ,it seems that it must add module before add include
@Shawnthebro
@Shawnthebro 5 ай бұрын
Good find! I'll make a note for 5.2 (and probably higher).
@halfbakedproductions7887
@halfbakedproductions7887 4 ай бұрын
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 4 ай бұрын
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.
@GoldnTouch448
@GoldnTouch448 11 ай бұрын
can you make a fighting game tutorial for ue5
@Shawnthebro
@Shawnthebro 11 ай бұрын
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 11 ай бұрын
@@Shawnthebro thank you I've been struggling for awhile
@Shawnthebro
@Shawnthebro 11 ай бұрын
No worries, my friend!
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3,4 МЛН
small vs big hoop #tiktok
00:12
Анастасия Тарасова
Рет қаралды 11 МЛН
Getting into C++ with Unreal Engine - Part1 - Setting up
34:49
UE5 C++ Enhanced Input - 5 - Directional Input to Move a Character
39:42
UE5 C++ Enhanced Input - 2 - Bind C++ Functions to Input Actions
53:17
Druid Mechanics
Рет қаралды 60 М.
How to Optimize Performance in Unreal Engine 5
17:40
Nu Makes Games
Рет қаралды 19 М.
How to Make a Forest in Minutes with PCG in Unreal Engine 5
13:53
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 92 М.
10 Unreal Engine 5 PLUGINS I can't live without!
9:37
Cinecom.net
Рет қаралды 466 М.
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 3,4 МЛН