Download

Strange InputComponent Error

Hello Everyone!

I’m having a weird issue with trying to add an InputComponent BindAction. here’s what it’s telling me



1>C:\Users\CHADALAK\Documents\Unreal Projects\CustomGame\Source\CustomGame\MyCharacter.cpp(51): error C2664: 'FInputActionBinding &UInputComponent::BindAction<AMyCharacter>(const FName,const EInputEvent,UserClass *,void (__cdecl AMyCharacter::* )(void))' : cannot convert argument 4 from 'void (__cdecl AMyCharacter::* )(AItem *)' to 'void (__cdecl AMyCharacter::* )(void)'
1>          with
1>          
1>              UserClass=AMyCharacter
1>          ]
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


and here’s my code for my input



InputComponent->BindAction("Action", IE_Pressed, this, &AMyCharacter::PickUp);


any idea what is happening here?

What is the signature of AMyCharacter::PickUp? Looking at it I’m thinking it must be AMyCharacter::PickUp(AItem* Item) or something like that.

Action delegate functions must have a void return type and no parameters.