HI All
I’m using 4.7.6.version now in unreal. I’m having a hidingpoint c++ class and using a boxcomponent in the class.I’m doing a delegate fn if a player overlaps with that Boxcomponent. I need to play a animation. I’ve created a function for playing a montage. In OnComponentBeginOverlap.AddDynamic is not working.
The code and the error is mentioned below:
BoxComponent = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, "BoxComponent");
RootComponent = BoxComponent;
BoxComponent->SetCollisionObjectType(ECC_Pawn);
/*BoxComponent->SetCollisionEnabled(ECollisionEnabled::QueryOnly);*/
BoxComponent->SetCollisionResponseToAllChannels(ECR_Overlap);
BoxComponent->OnComponentBeginOverlap.AddDynamic(this, &AHidingPoint::CollideWithOther);
void AHidingPoint::CollideWithOther()
{
UWorld* const World = GetWorld();
for (FConstPawnIterator It = World->GetPawnIterator(); It; ++It)
{
// Cast to the bots
Bot = Cast<ASEAICharacter>(*It);
}
FString name = Bot->GetName();
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, name);
Bot->PlaySneakMontage();
}
The error is
**error C2664: 'void TBaseDynamicMulticastDelegate::__Internal_AddDynamic(UserClass ,void
(__cdecl AHidingPoint:: )(AActor ,UPrimitiveComponent ,int32,bool,const FHitResult
&),const FString &)’ : cannot convert argument 2 from 'void (__cdecl AHidingPoint:: )
(void)’ to 'void (__cdecl AHidingPoint:: )(AActor ,UPrimitiveComponent
,int32,bool,const FHitResult &)’
Please help me with this issue
Thanks&Regards
Programmer