How do I send a string on Input?

Hey! I am trying to create a dash function, but it does not look like I can send the string via the player input. Anyone know what I can do?

InputComponent->BindAction("Left", IE_DoubleClick, this, &AInstinctCharacter::Dodge("left"));

void AInstinctCharacter::Dodge(FString direction)
{
	
}

Thank you in advance!

We don’t currently support parameters to actions bound to input events. You would need to create a DodgeLeft, DodgeRight, etc. function and the implementation of those could call a shared common function with the parameter you wish to pass.

So something like

void AInstinctCharacter::DodgeLeft()
{
Dodge(“left”);
}

Also, and this is just some unsolicited general advice, don’t use strings for something like this, create an enumeration or something like. Using strings for non-text things is a great way to slow game code down.

Oh okay, thats some pretty great advice :slight_smile: Thank you! Will look into the ENumeration thing, was not aware that it actually slowed down the game by that much. It feels kinda inconvient that I have to make 4 functions for “Dodge”, a seperate one for each key (wsad). Would you have some advice on that too? It would be really appreciated!