Download

Triggering engine breakpoint 50% of the time with a OnComponentHit Delegate?

EDIT: On further experimentation, it appears that it only happens when the object is generated in the level for the FIRST time, and I then hit ‘PIE’. Hitting PIE subsequently causes no crash. It seems to only happen the first time the collision is set-up…

Can’t figure out why, but I keep triggering an engine breakpoint when I hit play with one of these classes in the level. I’m sure I’ve set everything up right, the called function is a UFUNCTION and has the BlueprintNativeEvent tag, so why am I hitting this breakpoint.

Note, it happens when hitting either begin play or simulate…

Powerup.H:



	/* Called When The Powerup Collision Overlaps With Something */
	UFUNCTION(BlueprintNativeEvent)
	void OnCollectOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);


PowerUp.CPP



ABZGame_PowerUp::ABZGame_PowerUp(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	/* This actor needs to tick, otherwise it won't really do anything. */
	PrimaryActorTick.bCanEverTick = true;
	PrimaryActorTick.bStartWithTickEnabled = true;

	/* Create the Crate Mesh */
	CrateMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("CrateMesh"));
	GetCrateMesh()->SetSimulatePhysics(true);
	GetCrateMesh()->SetAngularDamping(0.0f);
	GetCrateMesh()->SetLinearDamping(0.01f);
	GetCrateMesh()->SetPhysicsMaxAngularVelocity(1600.0f);
	GetCrateMesh()->OnComponentHit.AddDynamic(this, &ABZGame_PowerUp::OnCollectOverlap);
	RootComponent = CrateMesh;
}




void ABZGame_PowerUp::OnCollectOverlap_Implementation(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString::Printf(TEXT("Test")));

	APawn* Collector = Cast<APawn>(OtherActor);
	if (Collector)
	{
		//if (CanPawnCollect(Collector))
		//{
		//	CollectPowerUp(GetGameObjectFromOverlap(Collector));
		//}
		//else
		//{
		//	RejectPowerUp();
		//}
	}
}


Any ideas why this is? The fact that it’s happening only a few times when I hit Play makes me wonder if it’s an engine bug?

Bump - Any ideas on this folks?

It appears to happen ONLY when the object is first simulated, after that, the breakpoint goes away. Interestingly, it doesn’t crash the editor, and play continues once the breakpoint has been hit.