Announcement

Collapse
No announcement yet.

Input event not firing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Input event not firing

    Hi,

    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:

    Code:
    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?

    Regards,

    acidrainlte

    #2
    Originally posted by acidrainlte View Post
    Code:
    bool UCustomViewport::InputKey(FViewport* InViewport, int32 ControllerId, FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad)
    }
    Code:
    return Super::InputKey(Viewport, ControllerId, Key, EventType, AmountDepressed, bGamepad);
    }
    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.
    Development Thread
    Pandora's Box - A small 2in1 project about big ideas.

    Comment

    Working...
    X