Action bindings not calling delegates

I’m trying to transition from UE3 to UE4 and the input component isn’t cooperating with me. I’m currently using the tower defense example as my starting point but I have had the same problem no matter what template I pick. I have set up 3 actions, ‘LMB’, ‘RMB’, ‘MMB’ to bind to the 3 main mouse buttons. They are set in the input section of project properties. Here they are in the input ini file

+ActionMappings=(ActionName="ZoomOut",Key=MouseScrollUp,bShift=False,bCtrl=False,bAlt=False)
+ActionMappings=(ActionName="ZoomIn",Key=MouseScrollDown,bShift=False,bCtrl=False,bAlt=False)
+ActionMappings=(ActionName="InGameMenu",Key=Escape,bShift=False,bCtrl=False,bAlt=False)
+ActionMappings=(ActionName="LMB",Key=LeftMouseButton,bShift=False,bCtrl=False,bAlt=False)
+ActionMappings=(ActionName="RMB",Key=RightMouseButton,bShift=False,bCtrl=False,bAlt=False)
+ActionMappings=(ActionName="MMB",Key=MiddleMouseButton,bShift=False,bCtrl=False,bAlt=False)

In strategyspectatorpawn.h I have added

/** Handles the mouse scrolling down. */
void OnMouseScrollUp();

/** Handles the mouse scrolling up. */
void OnMouseScrollDown();

void OnLMBPress();
void OnRMBPress();
void OnMMBPress();

In strategyspectatorpawn.cpp

void AStrategySpectatorPawn::OnMouseScrollUp()
{
	StrategyCameraComponent->OnZoomIn();
}

void AStrategySpectatorPawn::OnMouseScrollDown()
{
	StrategyCameraComponent->OnZoomOut();
}

void AStrategySpectatorPawn::OnLMBPress()
{
	int i = 0;
	i = 69;
}

void AStrategySpectatorPawn::OnRMBPress()
{
	int i = 0;
	i = 69;
}

void AStrategySpectatorPawn::OnMMBPress()
{
	int i = 0;
	i = 69;
}


void AStrategySpectatorPawn::SetupPlayerInputComponent(UInputComponent* InputComponent)
{
	check(InputComponent);
	
	InputComponent->BindAction("ZoomOut", IE_Pressed, this, &AStrategySpectatorPawn::OnMouseScrollUp);
	InputComponent->BindAction("ZoomIn", IE_Pressed, this, &AStrategySpectatorPawn::OnMouseScrollDown);

	InputComponent->BindAction("LMB", IE_Pressed, this, &AStrategySpectatorPawn::OnLMBPress);
	InputComponent->BindAction("RMB", IE_Pressed, this, &AStrategySpectatorPawn::OnRMBPress);
	InputComponent->BindAction("MMB", IE_Pressed, this, &AStrategySpectatorPawn::OnMMBPress);

	InputComponent->BindAxis("MoveForward", this, &AStrategySpectatorPawn::MoveForward);
	InputComponent->BindAxis("MoveRight", this, &AStrategySpectatorPawn::MoveRight);
}

I set breakpoints on the ‘i = 69;’ lines and ‘StrategyCameraComponent->OnZoomOut();’ etc lines to catch when any are called, compile and launch editor with debugger, hit play and spam my mouse buttons, debugger doesn’t break. Scroll the mouse wheel and it hits the breakpoints checking the mousewheel binds. I’ve googled around and read the docs and I can’t figure out what I am doing wrong. The delegates should be getting called but they just aren’t.

Additonal info:

I tried naming the actions something different

I tried binding the actions to buttons on the keyboard, it still didn’t trigger

I noticed this not working on a function that was meant to spawn something under mouse cursor so it isn’t because my delegates are just assigning a funny number to an integer, the delegates aren’t being called at all :frowning:

If you using development configuration,

int i = 0;
i = 69;

thoese codes will remove by compiler as junk code. I suggest to try to use another code, such as alloc new value to member variable.

Good to know it optimizes out little dummy functions like that, thanks. Guess I should do whatever `log(); is called now instead for testing things like this. Sure enough the code I posted works if I replace i=69 with a call to zoom out. However I opened up my earlier project with same problem and the player controller still can’t bind actions after similar changes, which is weird because I know controllers can take input not just pawns. My earlier project used top down template, not an example project. All I did was try to replace the ‘setdestination’ action with LMB RMB MMB etc

For now at least it seems the strategygame example project is firing off my binds so resolved, I guess! I can get on with other stuff now. Thanks again.