43 lines
946 B
C++
43 lines
946 B
C++
// Copyright Team Lumi. All Rights Reserved.
|
|
|
|
|
|
#include "LumiController.h"
|
|
|
|
#include "EnhancedInputSubsystems.h"
|
|
|
|
void ALumiController::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
if (InputMappingContext == nullptr)
|
|
{
|
|
UE_LOG(
|
|
LogTemp, Error,
|
|
TEXT("InputMappingContext is not set in %s. Please set it in the editor."), *GetName()
|
|
);
|
|
return;
|
|
}
|
|
|
|
const ULocalPlayer* LocalPlayer = GetLocalPlayer();
|
|
if (LocalPlayer == nullptr)
|
|
{
|
|
UE_LOG(
|
|
LogTemp, Error,
|
|
TEXT("LocalPlayer is null in %s. Please make sure the player is local."), *GetName()
|
|
);
|
|
return;
|
|
}
|
|
|
|
UEnhancedInputLocalPlayerSubsystem* Subsystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
|
|
if (Subsystem == nullptr)
|
|
{
|
|
UE_LOG(
|
|
LogTemp, Error,
|
|
TEXT("EnhancedInputLocalPlayerSubsystem is null in %s. Please make sure the plugin is enabled."), *GetName()
|
|
);
|
|
return;
|
|
}
|
|
|
|
Subsystem->AddMappingContext(InputMappingContext, MappingPriority);
|
|
}
|