Cannot bind OnComponentHit

I am having a bit of a problem binding OnComponentHit to one of my capsule components. The problem is that the implementation worked before and when I cleaned up the class (moving some variables around to make it more readable), it just stopped working. Not sure whether that is actually the cause, but thought I should mention. Anyways, as for the code:

.h

UFUNCTION()
	void OnFrontalCapsuleHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

.cpp

FrontalHitCheckCapsule->SetNotifyRigidBodyCollision(true);
FrontalHitCheckCapsule->OnComponentHit.AddDynamic(this, &MyCharacter::OnFrontalCapsuleHit);

void MyCharacter::OnFrontalCapsuleHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	UE_LOG(AnyLog, Log, TEXT("Got a hit"));
}

I have doublechecked the capsule components in the blueprint, and all of the relevant ones had the NotifyRigidBodyCollision set to true. I also tried binding it to the default CapsuleComponent instead of the one I added, but no luck there either. Would love to get this solved, as not being able to assign an OnHit kinda messes with the gameplay I was planning on implementing.

I have done some more experiments, and the problem is becoming weirder and weirder.

I have done 3 checks.
-First I checked whether the object was bound using IsBound(), which returned true.
-Secondly I checked more specifically using Contains(this, “OnFrontalCapsuleHit”), which also returned true.
-Lastly I checked which objects were bound by using GetAllObjects(), and confirmed that it was bound only to my character.

Despite all this, the function is just not being called on an actual hit.

OK, I hope this helps you.

This is the code I’m using in my project:

PickupCollisionSphere->OnComponentHit.AddDynamic(this, &APickup::HitTheGround);

void APickup::HitTheGround(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)

I was staring at the blueprint thingie for OnComponentHit and noticed that there’s a ‘Hit Component’ in front of the ‘Other Actor’ and your parameters didn’t include it.
Could this be the cause of your problems?

I’m using 4.12 btw.

Sorry, that wasn’t really my problem. With 4.12 they changed the signature a bit, adding an additional argument. If my problem was that of a lacking argument in my OnHit function, it would never have compiled to begin with. The problem here was that even though OnHit was bound and everything, it never actually fired.

The problem solved itself when I switched engines, so I still don’t know exactly what was wrong there.