ros.pro
(ros.pro)
1
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 =)
Daekesh
(Daekesh)
2
I imagine you’ve got yourself an infinite spawn loop.
ros.pro
(ros.pro)
3
But spawning occurs only on Overlap event…
Daekesh
(Daekesh)
4
Does it happen when you spawn just one of them? Or when you spawn more than 1? Or when you walk near it? What?
ros.pro
(ros.pro)
5
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());
ros.pro
(ros.pro)
6
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());
}
}