언리얼 엔진 리플렉션 시스템에서 쓰일수 있도록 UHT에게 알리는 C++ 매크로

언리얼에서 특정 트리거가 발동되는 콜백시점에 바인딩할때 해당 함수에 UFUNTION 매크로가 있지 않다면 정상적인 호출이 되지 않는다.

실제로 디버그 걸어보면 Unable to bind delegate to '%s' (function might not be marked as a UFUNCTION or object may be pending kill) 라는 에러를 발생시킨다.

(문제는 정상적으로 실행은 되면서 함수가 호출이 안되기 때문에 디버그하는데 별거아닌데 시간이 걸렸다 .. ㅠㅠ)

// 문제가 되던코드
void OnStageTriggerBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
// 위코드를 상속받아서 구현하고 
UBoxComponent* GateTrigger = CreateDefaultSubobject<UBoxComponent>(TriggerName);
GateTrigger->SetBoxExtent(FVector(100.0f, 100.0f, 300.0f));
GateTrigger->SetupAttachment(Stage, GateSocket);
GateTrigger->SetRelativeLocation(FVector(70.0f, 0.0f, 250.0f));
GateTrigger->SetCollisionProfileName(CPROFILE_ABTRIGGER);
GateTrigger->OnComponentBeginOverlap.AddDynamic(this, &AABStageGimmick::OnGateTriggerBeginOverlap);

//AddDynamic으로 해당함수를 바인딩 하려고 했을시 문제가 발생했다.

UFUNTION()
void OnStageTriggerBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
// 이렇게 함수위에 언리얼 UHT가 알아먹을수 있도록 UFUNTION() 매크로를 추가하면 정상적으로 실행된다.

참고 문서: UE4 has triggered a breakpoint - Development / Programming & Scripting - Epic Developer Community Forums (unrealengine.com)