FennecFix
(FennecFix)
February 25, 2017, 2:03pm
1
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?
Wurmloch83
(Wurmloch83)
February 25, 2017, 2:12pm
2
Seems that your ATower::SpawnDrone has the wrong signature.
Is:
void SpawnDrone();
Should be:
void SpawnDrone(AActor* actor,FKey key);
FennecFix
(FennecFix)
February 25, 2017, 2:54pm
3
Okay, thanks a lot, it really was a wrong signature.
Could you please tell me, where can I read about this in documentation?
Wurmloch83
(Wurmloch83)
February 25, 2017, 3:04pm
4
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)