Are you trying to bind some function to your delegate ? if that, can you show your delegate and function you want to bind ?
After fixing a bad definition error, i just got this. Any ideas?
error C2664: 'void TBaseDynamicMulticastDelegate_FiveParams<void,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &,FWeakObjectPtr>::__Internal_AddDynamic<AcoinBrick>(UserClass *,void (__cdecl AcoinBrick::* )(Param1Type,Param2Type,Param3Type,Param4Type,Param5Type),const FString &)' : cannot convert argument 2 from 'void (__cdecl AcoinBrick::* )(AActor *,UPrimitiveComponent *,int32,bool,FHitResult)' to 'void (__cdecl AcoinBrick::* )(Param1Type,Param2Type,Param3Type,Param4Type,Param5Type)'
Not quite sure what delegates are, but i’ll show you some stuff that i think is relevant.
.h
UFUNCTION()
void OnCollision(AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, FHitResult SweepResult);
.cpp
CollisionPlate->OnComponentBeginOverlap.AddDynamic(this, &AcoinBrick::OnCollision, int32 OtherBodyIndex, bool bFromSweep, FHitResult SweepResult);
void AcoinBrick::OnCollision(AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, FHitResult SweepResult)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(0, 10.0f, FColor::White, TEXT("Begin Overlap"));
}
}
Your argumentsb still not fitting, i think this time problrm is that delegate expects const FHitResult &
not just FHitResult, look on beggining of error you will see which types he expects.
oh, ok, OnComponentBeginOverlap is a delegate, it let you bind another function with same parameter to it, so you just need this
CollisionPlate->OnComponentBeginOverlap.AddDynamic(this, &AcoinBrick::OnCollision);
Thats what i already had, then i changed it, still no fix.
check OnComponentBeginOverlap of CollisionPlate, AcoinBrick::OnCollision must have exactly same parameter.
Changed it, same error, been a very problematic process for me, asked like 3 or 4 questions on this
coinBrick.h
UFUNCTION()
void OnCollision(AActor * OtherActor, UPrimitiveComponent * OtherComp);
coinBrick.cpp
CollisionPlate->OnComponentBeginOverlap.AddDynamic(this, &AcoinBrick::OnCollision);
void AcoinBrick::OnCollision(AActor * OtherActor, UPrimitiveComponent * OtherComp,)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(0, 10.0f, FColor::White, TEXT("Begin Overlap"));
}
}
Finally fixed by looking at the FPS Shooter tutorials collision segment, it appears i was missing some params, in the end i just changed to Hit.
From
void OnCollision(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
};
To
UFUNCTION()
void OnHit(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
From
void AcoinBrick::OnCollision(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
}
To
void AcoinBrick::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if (OtherActor && (OtherActor != this) && OtherComp)
{
this->Destroy();
}
}