I’m using a custom controller for input, trying to get enhanced input system to work. There’s no errors now but when I click, nothing happens so not a lot to go off of.
To be clear, I’m not asking about or talking about the trace. Even the logs don’t trigger.
Here’s the script:
// Fill out your copyright notice in the Description page of Project Settings.
#include "GameController.h"
#include "EnhancedInputSubsystems.h"
#include "EnhancedInputComponent.h"
AGameController::AGameController() {
}
void AGameController::BeginPlay() {
Super::BeginPlay();
SetShowMouseCursor(true);
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
Subsystem->AddMappingContext(CRPGMapContext, 0);
}
}
void AGameController::Tick(float DeltaTime) {
Super::Tick(DeltaTime);
}
void AGameController::SetupInputComponent()
{
Super::SetupInputComponent();
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent))
{
EnhancedInputComponent->BindAction(LCAction, ETriggerEvent::Started, this, &AGameController::LeftClick);
}
}
void AGameController::LeftClick(const FInputActionValue& Value) {
FHitResult hitRes;
GetHitResultUnderCursorByChannel(ETraceTypeQuery::TraceTypeQuery1, true, hitRes);
UE_LOG(LogTemp, Warning, TEXT("PEWPEW"));
UE_LOG(LogTemp, Warning, TEXT("/s"), hitRes.GetActor()->execStringConst);
}