PlayerInputComponent Issues


PlayerInputComponent->BindAction("Sprint", IE_Pressed, this, &ATesterAndStuffCharacter::Run);
PlayerInputComponent->BindAction("Sprint", IE_Released, this, &ATesterAndStuffCharacter::StopRun);

“->” of both pointer functions are underlined red, saying this error:
no instance of overloaded function “UInputComponent::BindAction” matches the argument list
argument types are: (const char [7], EInputEvent, ATesterAndStuffCharacter
,void (ATesterAndStuffCharacter::)())
object type is: UInputComponent
*
I sincerely don’t understand this error, everything should work, it has the same signature as the rest code for input.

I’ve tried many things to fix it but I still don’t understand what is going on…

Is that error coming from the compiler? Or just from intellisense? If it’s from intellisense, ignore it. If it’s from the Compiler, it could be because - for whatever reason - it’s not converting your string literal to an FName.

You could try something like the following:



PlayerInputComponent->BindAction(FName("Sprint"), IE_Pressed, this, &ATesterAndStuffCharacter::Run);
PlayerInputComponent->BindAction(FName("Sprint"), IE_Released, this, &ATesterAndStuffCharacter::StopRun);


But I don’t see why that’s necessary. This could all be a red herring and the real issue is just before those lines.

Post more code.

Try TEXT(“Sprint”)