Hi Lordmatics,
I had the same problem and that’s what i did to resolve it:
.h
void AbilityTestInUse(int32 index);
template<int32 Index>
void AbilityTestInUse()
{
AbilityTestInUse(Index);
}
.cpp
InputComponent->BindAction("Ability1", IE_Pressed, MyCharacter, &AConceptCharacter::AbilityTestInUse<1>);
InputComponent->BindAction("Ability2", IE_Pressed, MyCharacter, &AConceptCharacter::AbilityTestInUse<2>);
InputComponent->BindAction("Ability3", IE_Pressed, MyCharacter, &AConceptCharacter::AbilityTestInUse<3>);
InputComponent->BindAction("Ability4", IE_Pressed, MyCharacter, &AConceptCharacter::AbilityTestInUse<4>);
InputComponent->BindAction("Ability5", IE_Pressed, MyCharacter, &AConceptCharacter::AbilityTestInUse<5>);
void AConceptCharacter::AbilityTestInUse(int32 index) {
// do stuff
}
It’s because templates are always declared in header (if not, you cannot compile)