I have a box collision. With this inside the BeginPlay.
Box_Collision->OnComponentBeginOverlap.AddDynamic(this, &ABallBound::OnOverlapBegin);
And the function is
void ABallBound::OnOverlapBegin(UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp,
int32 OtherBodyIndexType, bool bFromSweep, const FHitResult &SweepResult)
{
if (OtherActor->ActorHasTag("Ball")) {
OtherActor->Destroy();
}
}
The code works in the editor when I play the game in the viewport but it doesn’t work when I package the project.
I don’t have any idea why would it work in the viewport and not after packaging. Then what is the point of having the viewport if it is not consistent? Shouldn’t I trust viewport?
This is only a collision box without anything else attached. This is in the constructor.
Box_Collision = CreateDefaultSubobject<UBoxComponent>(TEXT("Box Collision"));
RootComponent = Box_Collision;
The ball goes into the collision box and gets destroyed. Simple. But after packaging OR using the quick launch from the platforms menu, it doesn’t. It just goes through it.
On Windows 10 and SDK 10.0.22000.0