OK, so I created a player controller class and added code to it but nothing happens, I added debug messages and those aren’t being printed either. Can I get help? (BTW I created the class from scratch or blank sheet)
#include "MyProject.h"
#include "MyPlayerController.h"
AMyPlayerController::AMyPlayerController()
{
PrimaryActorTick.bCanEverTick = false;
}
void AMyPlayerController::BeginPlay(void)
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Logged -1"));
}
void AMyPlayerController::Tick(float deltaTime)
{
Super::Tick(deltaTime);
}
//void AMyPlayerController::SetupPlayerInputComponent(class UInputComponent *playerInput)
void AMyPlayerController::SetupInputComponent()
{
//Super::SetupPlayerInputComponent(playerInput);
Super::SetupInputComponent();
//playerInput->BindAction("myNewBinding", IE_Released, this, &AMyPlayerController::displayMSG);
check(InputComponent);
if (InputComponent != nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Logged 0"));
InputComponent->BindAction("myBinding", IE_Pressed, this, &AMyPlayerController::displayMSG);
InputComponent->BindAction("myBinding", IE_Released, this, &AMyPlayerController::displayMSG1);
}
//return 0;
}
void AMyPlayerController::displayMSG(void)
{
UE_LOG(LogTemp, Warning, TEXT("Logged 1"));
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("Key recognized."));
}
void AMyPlayerController::displayMSG1(void)
{
UE_LOG(LogTemp, Warning, TEXT("Logged 2"));
GEngine->AddOnScreenDebugMessage(0, 5.0f, FColor::Red, TEXT("Key released."));
}