unable to include Enhanced Input in 5.1 project

in my current project (started in blueprint mode) I am trying to created a C++ class version of the ACharacter class. I know I need to do SetupPlayerInputComponent() and that for the Enhanced Input System should only need to

#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"

but VS doesn’t recognize those files and is throwing a fit wanting me to use

#include "../../../../../../Unreal/UE_5.1/Engine/Plugins/Experimental/VirtualCamera/Source/VCamCore/Public/VCamComponent.h"
#include "../../../../../../Unreal/UE_5.1/Engine/Plugins/EnhancedInput/Source/EnhancedInput/Public/InputTriggers.h"

which feels wrong, and still throws up at anything with EnhancedInputComponent passing in the function delegates
the Enhanced Input stuff works with the template blueprint in the project, but including the headers should be trivial.
is there something I am missing to allow me to include those files?

3 Likes

for some reason even though Enhanced Input Subsystem is supposed to be a continual feature starting in 5.1 going forward, and is fully accessible from blueprints (without needing to include it) in order to use it in C++ it must still be explicitly enabled in the Build.cs

[project directory]/Source/[ProjectName]/[ProjectName].Build.cs

PublicDependencyModuleNames.AddRange(new string[] { ..."EnhancedInput"...});

then launch the editor (probably through the .uproject as trying to include a file for a non-included module will have errors in your code.

Tools->“Refresh Visual Studio Project”

if the system is enabled by default in blueprints without any plugin then it should be included by default for use in C++ (if the project was made as a C++ project from start both EnhancedInput and HeadMountedDisplay are included by default)
maybe there is some intention in the future to fold EnhancedInput into InputCore when the older method is fully deprecated, but if the intention that EnhandedInput is the focus going forward then it should probably be included even in blueprint projects.

8 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.