1xu7
(1xu7)
March 5, 2024, 10:10pm
1
Hi!
I’m trying to transcribe VRPawn’s Blueprint to C++ (from VR Template), on BeginPlay()
but im stuck at this point (image included)
I cant find a way to get Enhanced Input Local Player Subsystem from Player Controller, it looks like there is no way to get it at least looking at documents:
APlayerController | Unreal Engine 5.2 Documentation
How can i get it ?
Thanks.
SolidSk
(SolidSk)
March 5, 2024, 10:18pm
2
#include "Engine/LocalPlayer.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
void Class::BeginPlay()
{
Super::BeginPlay();
if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
{
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
{
Subsystem->AddMappingContext(DefaultMappingContext, 0);
}
}
}
Add EnhancedInput to your Project.Build.cs file:
PublicDependencyModuleNames.AddRange(new[]
{
...,
"EnhancedInput"
});
3 Likes
1xu7
(1xu7)
March 5, 2024, 11:18pm
3
Thanks for the fast reply…
system
(system)
Closed
April 4, 2024, 11:19pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.