unreal engine c++ bind weapon to function with parameters
void AChar::UseSlot(int slot)
{
...
}
template<int Index>
void AChar::UseSlot()
{
UseSlot(Index);
}
void AChar::SetupPlayerInputComponent(class UInputComponent* InputComp)
{
check(InputComp);
InputComp->BindAction("UseSlot1", EInputEvent::IE_Pressed, this, &AChar::UseSlot<1>);
InputComp->BindAction("UseSlot2", EInputEvent::IE_Pressed, this, &AChar::UseSlot<2>);
}