Issues in 4.16.2

I’m having some issues in 4.16.2, my solution to which has caused the gun to spawn two projectiles though OnFire(). So the code below does not paste into BeginPlay() because ‘PlayerInputComponent’ is not recognised (its only referenced in the Setup function)

if (EnableTouchscreenMovement(PlayerInputComponent) == false) {
	PlayerInputComponent->BindAction("Fire", IE_Pressed, myGun, &AGun::OnFire);
}

Resultantly I just moved the code spawning the gun into the SetUpPlayerInputComponent() function instead of the solution in the video which works in the opposite way (Moving input binding to BeginPlay()). The gun works as expected and there is only one instance of the gun being created, however when I right click I get two projectiles.

Has anyone else experienced this and found a solution, its not a major problem but it would be nice to know how to fix.

@sampattuzzi / @ben - I seem to be having this same issue.

Here is a snapshot of the change and the error I’m getting:

image

Now I could remove the “PlayerInputComponent” from the highlight but it will only complain again on the next time down.

Here is the error I am receiving:


Now I could do what Harry mentioned above and move all the code into the Player Setup. But that seems a bit messy.

Any ideas?

You might need this header:

#include "Components/InputComponent.h"

Thanks for the reply sam. I shall give this a go later when I get home from work :slight_smile:.

Hey @sampattuzzi,

SO I have finally got round to testing your fix and low and behold it works.

Turns out I had to do a little more than just add in the “#include”. I also had to change “PlayerInputComponent” to just “InputComponent” and it compiled.

Now to test if it works…

Edit: Yep she works :smile:

3 Likes

Privacy & Terms