Hi there.
I have a c++ based blueprint with OnComponentBeginOverlap.AddDynamic inside Constructor.
If I drag & drop the blueprint from Content Browser it works, but if I move the actor with Ctrl-C/Ctrl-V , CtrlX-Ctrl-V or “Move Selection to current level” the OnComponentBeginOverlap will not trigger again.
this is my c++ class setup.
AInteractiveObjectActor::AInteractiveObjectActor()
{
PrimaryActorTick.bCanEverTick = true;
m_rootMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
//Let's make the meshComponent the RootComponent
RootComponent = m_rootMeshComponent;
// Setup trigger
m_trigger = CreateDefaultSubobject<UBoxComponent>(TEXT("TriggerCollider"));
m_trigger->SetupAttachment(RootComponent);
m_trigger->OnComponentBeginOverlap.AddDynamic(this, &AInteractiveObjectActor::OnTriggerEnter);
m_trigger->OnComponentEndOverlap.AddDynamic(this, &AInteractiveObjectActor::OnTriggerExit);
// Both colliders need to have this set to true for events to fire
m_trigger->bGenerateOverlapEvents = true;
// Set the collision mode for the collider
// This mode will only enable the collider for raycasts, sweeps, and overlaps
m_trigger->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
}