Download

sphereComponent AddDynamic overlap event sometime not working

Hi,
I’ve met a new issue about overlap event dynamically added for sphereComponent sometime not working in blueprint child class.

 Here's the inheritance for my classes:
 1. [c++] class A :  sphereComponent->OnComponentBeginOverlap.AddDynamic(this, &class A::CustomOverlap ) in constructor;
 2. [c++] class B child of class A
 3. [BP] class C child of class B

  Now I placed one instance of class C into my level, and:
 1. CustomOverlap fired when player pawn triggered sphere.
 2. CustomOverlap not firing any more after sphere's Location \ Scale get changed
 3. CustomOverlap not firing after sphereComponentBeginOverlap Event added into BP of class B
 4. CustomOverlap fired again after sphereComponentBeginOverlap Event added into BP of class C

 The following things have been checked:
 1. Constructors work fine
 2. BeginPlay \ Tick \ Destroy for all these children \ grandchildren class work fine with Super::method called
 3. Tick Enabled

 Any ideas? thx

Is the colliding actor still overlapping when you change location and scale, and you expect the overlap to fire again. Or is it that it doesn’t fire after location and scale change and the actor enters the collision sphere again?

Thx for ur reply.

This issue is not about runtime scale \ location change. It’s just occurred when adjusting normally in editor.

I’ve found out that “bGenerateOverlapEvents” of sphereComponent belongs to child actor of class C in those instances placed in current level were set to false. However there arent any call of SetGenerateOverlapEvents() at all(Neither in C++ code nor in BP code). And also, the value in original actor is “true”. Thats so weird…

Not sure if you tried this, but calling .AddDynamic in the constructor is usually not the best idea, because it causes to clear the invocation list in many cases. It’s better to call this at BeginPlay()

I’ll try it, many thanks!