How to handle clicks on Actors? (in code)

Can’t even google an answer for this question.

I’ve added this code to my Actor class

ATower::ATower()
{
	PrimaryActorTick.bCanEverTick = false;

	OnClicked.AddDynamic(this, &ATower::SpawnDrone);
}

But I can’t manage this code to work. It keep throwing an error

Error C:\Users\Fennec\Documents\Unreal
Projects\Towers\Source\Towers\Tower.cpp(13)
: error C2664: ‘void
TBaseDynamicMulticastDelegate ,FKey>::__Internal_AddDynamic(UserClass ,void (__cdecl ATower:: )(AActor ,FKey),FName)': cannot convert argument 2 from 'void (__cdecl
ATower::
)(void)’ to 'void (__cdecl
ATower::
)(AActor *,FKey)’

How do I make it work?

Seems that your ATower::SpawnDrone has the wrong signature.

Is:

void SpawnDrone();

Should be:

void SpawnDrone(AActor* actor,FKey key);

Okay, thanks a lot, it really was a wrong signature.

Could you please tell me, where can I read about this in documentation?

No, I can not. It really should be here, but it is not. I got the signature from the compiler’s error message that you posted, And of course it can be found in code: DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams( FActorOnClickedSignature, AActor*, TouchedActor , FKey, ButtonPressed ); (Actor.h:34)