Hi All,
I am trying to add a simple key press input to trigger a function in my **Actor **derived Class.
But I can’t seem to be able to trigger the function. I have tried a few different keys/buttons but they all seem to map to something in the UE4 Editor window. Could the reason they don’t get to my function be that the UE GUI intercepts and doesn’t pass them on?
I have tried both with a blueprint method and a code method but with no luck.
This does not work. (but if I wire up an ‘Event Tick’ instead the function gets triggered fine.)
This is what I am doing in code:
.h
class PROGRAMMINGEXMPL1_API AMyTextureControllerA : public AActor
{
GENERATED_UCLASS_BODY()
void SetupPlayerInputComponent(class UInputComponent* InputComponent);
.cpp
void AMyTextureControllerA::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
check(InputComponent);
InputComponent->BindAction("RandTexture", IE_Pressed, this, &AMyTextureControllerA::RandomizeTexture);
}
But none of these methods seems to work. What am I missing?
Cheers