Spawn Actor freezes Editor

Hello!

I need some help =)

Actor spawning from itself and freezes Editor. What’s wrong?

AGHHole::AGHHole(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}

void AGHHole::OnOverlap(class AActor* OtherActor)
{	
	GetWorld()->SpawnActor<AGHHole>(AGHHole::StaticClass());
}

Thanks =)

I imagine you’ve got yourself an infinite spawn loop.

But spawning occurs only on Overlap event…

Does it happen when you spawn just one of them? Or when you spawn more than 1? Or when you walk near it? What?

It is 2d game.
Overlap event occurs when projectile overlaping trigger(GHHole). Once.

And Overlap event occurs once.
And Editor freezes on this line:
GetWorld()->SpawnActor(AGHHole::StaticClass());

Yes! You were right!!!

I added overlap flag to projectile and get it working!

AGHHole::AGHHole(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 {
 }
 
 void AGHHole::OnOverlap(class AActor* OtherActor)
 {    
	AGHBall* ball = (AGHBall*)OtherActor;
	
	if (ball->bOverlap == false)
	{
		ball->bOverlap = true;
		GetWorld()->SpawnActor<AGHHole>(AGHHole::StaticClass());
	}     
 }