.h: UFUNCTION() virtual void StartTouchEvent(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult); UFUNCTION() virtual void EndTouchEvent(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex); .cpp: void UTouchCableComponent::BeginPlay() { //绑定开始触碰事件,Target是要绑定的物体 FScriptDelegate CollisionDelegate; CollisionDelegate.BindUFunction(this, "StartTouchEvent"); Target->OnComponentBeginOverlap.Add(CollisionDelegate); //绑定结束触碰事件 FScriptDelegate EndTouchDelegate; EndTouchDelegate.BindUFunction(this, "EndTouchEvent"); Target->OnComponentEndOverlap.Add(EndTouchDelegate); }