Input event not firing


This is just some test code but I can’t seem to make it work. It compiles with no issues but does nothing when I actually press the Q key in the game:

UCustomViewport::UCustomViewport(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)


bool UCustomViewport::InputKey(FViewport* InViewport, int32 ControllerId, FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad)
	if (EventType == EInputEvent::IE_Pressed && Key == EKeys::Q)
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("This is an on screen message!"));
			return true;

	return Super::InputKey(Viewport, ControllerId, Key, EventType, AmountDepressed, bGamepad);

Not quite sure where I’m going wrong here. Can someone please point me in the right direction?



Looks like you return ‘Viewport’ instead of ‘InViewport’. Simple typo of sorts maybe? Not a coder at all, just can’t resist trying to solve a puzzle. :slight_smile: