Binding a function in code to OnComponentBeginOverlap, OnComponentEndOverlap, or OnComponentHit does not trigger the bound function from code.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test) USphereComponent* SphereComp; UFUNCTION(BlueprintCallable, Category = Test) void SphereFunc(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
#include "Engine.h"
SphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp")); SphereComp->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::SphereFunc);
void AMyActor::SphereFunc(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::Red, TEXT("Overlap")); } }
Result:
Bound SphereFunc doesn't print Overlap message
Expected:
When OnComponentOverlap triggers, function bound in code triggers as well.
Repro Rate:
3/3
Head over to the existing Questions & Answers thread and let us know what's up.
2 |
Component | UE - Gameplay - Components |
---|---|
Affects Versions | 4.11.2 |
Target Fix | 4.12 |
Created | Apr 25, 2016 |
---|---|
Resolved | Apr 25, 2016 |
Updated | Apr 27, 2018 |