Hello folks,
I created a Character with an InputComponent which worked flawless.
Now I tried to do the same with a Player Controller.
I Set my Binding in the Editor and checked its Name multiple Times.
I also set my Controller inside my GameMode
if I execute the method Test inside the Tick method it is succesfully executed as expected.
However I cant execute it with the Binding.
Did I forget something that has to be done inside the Controller what you dont have to do inside the Character?
Any Help is much appreciated
Here is the very basic code how I tried to test the Binding.
.cpp File
// Fill out your copyright notice in the Description page of Project Settings.
#include "Learning.h"
#include "BasePlayerController.h"
ABasePlayerController::ABasePlayerController()
{
bShowMouseCursor = true;
DefaultMouseCursor = EMouseCursor::Crosshairs;
}
void ABasePlayerController::PlayerTick(float DeltaTime)
{
}
void ABasePlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
InputComponent->BindAction("Test", IE_Pressed, this, &ABasePlayerController::Test);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: SetupInputComponent")));
}
void ABasePlayerController::Test()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST: Strave")));
}
.h File
#pragma once
#include "GameFramework/PlayerController.h"
#include "BasePlayerController.generated.h"
/*
*
*/
UCLASS()
class LEARNING_API ABasePlayerController : public APlayerController
{
GENERATED_BODY()
public:
ABasePlayerController();
protected:
virtual void PlayerTick(float DeltaTime) override;
virtual void SetupInputComponent() override;
void ABasePlayerController::Test();
};