Overlap And Hit Events Don't Work After Compiling [BUG]

Hello everyone,

I just came across interesting problem related to overlap/hit events. I have a C++ based blueprint, and I set up everything in the blueprint. After that, I needed a hit event and added in the code. After compiling the code, the event wasn’t being fired. I created a new blueprint which is based on the same code and the event in the new blueprint was working, however, the event in the old blueprint wasn’t still working. Same thing happened when I needed to add overlap events as well, and I solved the problem by creating a new blueprint. Is this a kind of bug in UE 4.20? Or is there any solution to fix this? Because I don’t want to set up everything again and again when I need to add an event.

EDIT: This problem is not related to collision channels. Events work fine if I create them in the blueprint

// h file

UFUNCTION()
void OnHit(UPrimitiveComponent* hitComponent, AActor* otherActor, UPrimitiveComponent* otherComp, FVector normalImpulse, const FHitResult& hit);

UFUNCTION()
void OnBeginOverlap(UPrimitiveComponent* overlappedComp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult &sweepResult);

// cpp file

//...
Mesh1->SetSimulatePhysics(true);
Mesh1->SetGenerateOverlapEvents(true);
Mesh1->SetNotifyRigidBodyCollision(true);
Mesh1->OnComponentHit.AddDynamic(this, &AClass::OnHit);

//...
Mesh2->SetGenerateOverlapEvents(true);
Mesh2->OnComponentBeginOverlap.AddDynamic(this, &AClass::OnBeginOverlap);

I have exactly the same problem, did you find any solution?

This I call hot reload bug. In all my same situations i simply re-parent the BP class to AActor and back and this bug gone. But sometimes even reparenting doesn’t help me. Closing the editor and rebuilding with new BP created parent of buggy class completely obliterate this bug for me. P.S. After compiling look at your BP changes in class. Sometimes its does’t happens for me.

I haven’t found any solution yet but I have found what causes this issue. When you create a base class and get inheritance from that class to create a new class, the events you change in the base class isn’t updated in the derived class unless you create a new blueprint. For example: let’s say you create a base class named Class A and get inheritance from that class to create a new class named Class B; and you create a blueprint from Class B. If you add or update an event in Class A, Class B doesn’t see any changes related to the events; however, if you add or update an event in Class B, it works normally.

Currently, when I need to add or update events in the base class, I need to create the blueprint again and I hope, I won’t need to do that.

Re-parenting the BP class might be a solution. I’ll give it a try when I need to add or update any event.

Thank you.