I’m trying to create dynamic tiles for an endless runner game. I have a mastertile class which have a mesh and arrow component and I have created bp ver of this class that is the tile im going to use in-game .my problem is when I pass collision box for the first time It creats a tile perfectly but if I pass for a second time my game crash as stack overflowed and i have no idea why that is as it should simply create another tile on same exact location as last one.
UFUNCTION()
void AMasterTile::OnOverlapBegin(UPrimitiveComponent * OverlappedComp,
AActor * OtherActor, UPrimitiveComponent * OtherComp,
int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
AMistakeCharacter* Hero = (AMistakeCharacter*)OtherActor;
if (OtherActor == Hero)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Overlap Begin"));
FVector location = this->arrow->GetComponentLocation();
GetWorld()->SpawnActor(this->GetActorClass(), &location);
}
}