C++ Overlap Triggers Only When BP Node Exists

I have seen this weird behaviour handful of times now and cannot figure out what is going on.

I create an overlap trigger function in code as usual

// Constructor
Flipbook->OnComponentBeginOverlap.AddDynamic(this, &AProjectileBase::OnFlipbookOverlap);
....
void AProjectileBase::OnFlipbookOverlap(...)
{
    	UE_LOG(LogTemp, Warning, TEXT("Your message"));
}

While testing, this overlap never triggers.
But if I add a BeginOverlap Node to the blueprint, suddenly the C++ code starts executing properly. If the node is removed, the C++ trigger also stops executing.

305661-bug.png

What is going on here?

Try putting:

 Flipbook->OnComponentBeginOverlap.AddDynamic(this, &AProjectileBase::OnFlipbookOverlap);

in the BeginPlay and not in the constructor.

Is there any particular reason why this should work? By looking at code by Epic, I see only AddDynamic being called in the constructor. Examples link1 link2

Have you tried it? It takes less than 10 seconds to test it out.

Also, does the UFUNCTION OnFlipbookOverlap have the right signature?

I have tried it and it sadly did not work. The bug also included “Tick” function. If blueprint Tick node was not present in the Blueprint, C++ tick function was not being executed. After hours of digging, I have created a secondary Blueprint containing the same settings and everything is working as expected. So I can only assume it was the UPS that freaked out during one of the compiles and never recovered.

I would be still very much interested in the reasoning why would AddDynamic on Begin play help in this situation. I have seen it on forums here and there and I am very keen on using best practices.