C++ OnBeginOverlap doesn't work but blueprint does

Hello

The AddDynamic function seems to not works.

217908-capture3.jpg

This is my projectile blueprint

This is my character blueprint

The overlap event is not trigger when a bullet collide with the player. However the OnBeginOverlap in blueprint works.

I have also the “OnHit” in c++ and it works contrary to OnBeginOverlap.

I am totally confuse and I don’t know what to do to fix this. Someone can tell me what I’m doing wrong please.

Sorry for my English.

Is your component activated?
Did you Initialize it?

Yes

OnHit working in c++ and OnBeginOverlap working on blueprint

I have to use blueprint to do the job.

218040-capture.png

But I don’t like that. Please someone can tell me what I miss to trigger the event correctly in c++.

I have switch yesterday to UE 4.18 and it doesn’t fix the problem.

Thank you

I fix it !

I put MeshComp->OnComponentBeginOverlap.AddDynamic(this, &ABulletProjectile::OnBeginOverlap); in the BeginPlay function instead of the constructor.

That’s weird because MeshComp->OnComponentHit.AddDynamic(this, &ABulletProjectile::OnHit); works in the constructor.

1 Like