I’m using EnableInput whenever the beginoverlap event is called and the OtherActor is my character but it doesn’t work. I googled around and couldn’t find any answers that worked for me is there something I’m missing?
Using when I use the Fire Event in blueprints it works even without enabling input.
Setup in the Header file:
void FireHandler();
UInputComponent* InputComp;
Inside the constructor:
InputComp = CreateDefaultSubobject<UInputComponent>(TEXT("InputComp"));
InputComp->bBlockInput = bBlockInput;
BeginPlay:
Super::BeginPlay();
InputComp->BindAction("Fire", IE_Pressed, this, &AMasterWeapon::FireHandler);
Overlapped:
ACharacter* MyChar = Cast<ACharacter>(OtherActor);
if (MyChar != nullptr) {
UE_LOG(LogTemp, Warning, TEXT("In"));
EnableInput(Cast<APlayerController>(MyChar->GetController()));
}
FireHandler:
UE_LOG(LogTemp, Warning, TEXT("Fire"));