I am stuck with this error:
C:\Users\Konrad\Documents\Unreal Projects\ClassicArcade\Source\ClassicArcade\Floor.cpp(22) : error C2664: "void TSparseDynamicDelegate<FComponentBeginOverlapSignature_MCSignature,UPrimitiveComponent,FComponentBeginOverlapSignatureInfoGetter>::__Internal_AddDynamic(UserClass ,void (__cdecl AFloor:: )(UPrimitiveComponent *,AActor *,UPrimitiveComponent ,int32,bool,const FHitResult &),FName)": nie mo?na dokona? konwersji argumentu 2 z "void (__cdecl AFloor:: )(AActor *,UPrimitiveComponent ,int32,bool,const FHitResult &)" do "void (__cdecl AFloor:: )(UPrimitiveComponent *,AActor *,UPrimitiveComponent *,int32,bool,const FHitResult &)" with [ UserClass=AFloor ]
"nie mo?na dokona? konwersji argumentu 2 z" means "that cannot converse second parameter from .... to ...."
Code:
BoxCollision = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollision"));
BoxCollision->SetupAttachment(SceneRoot);
BoxCollision->OnComponentBeginOverlap.AddDynamic(this, &AFloor::OnOverlap);
void AFloor::OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (OtherActor && (OtherActor != this))
{
GameMode->SpawnNextFloor(OtherActor->GetActorLocation());
}
}
In header file I have UFUNCTION()
specifier. Visual Studio gives me message that there is no function template compatible with parameters.
Header:
UFUNCTION()
void OnOverlap(class UPrimitiveComponent* Comp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
Implementation:
void AFloor::OnOverlap(UPrimitiveComponent*, class AActor* OtherActor, UPrimitiveComponent*, int32, bool, const FHitResult&)
{
if (OtherActor && (OtherActor != this))
{
GameMode->SpawnNextFloor(OtherActor->GetActorLocation());
}
}