Enhanced Input in PlayerController

Enhanced Input in PlayerController
 avatar
JeanGrey
c_cpp
a year ago
587 B
22
Indexable
Never
// Jeangrey´s c++ code
// Enhanced Input in BlasterPlayerController

// BlasterPlayerController.h
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
UInputAction* QuitAction;
	
	
// BlasterPlayerController.cpp
void ABlasterPlayerController::SetupInputComponent()
{
	Super::SetupInputComponent();

	if (InputComponent == nullptr) return;
	if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent))
	{
		EnhancedInputComponent->BindAction(QuitAction, ETriggerEvent::Completed, this, &ABlasterPlayerController::ShowRetunToMainMenu);
	}
}