AActor::OnTakeAnyDamage
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate broadcast whenever this actor takes any form of damage (point, radial, or generic). Bind to this in Blueprint or C++ to react to damage without overriding TakeDamage.
Caveats & Gotchas
- • Only fired on the server (or in single-player). It is not replicated to clients — do not drive cosmetic feedback solely from this delegate without additional replication.
- • This fires after TakeDamage has already processed the damage. The Damage parameter reflects what was actually applied, which may differ from what was requested if TakeDamage was overridden to modify it.
Signature
UPROPERTY(BlueprintAssignable, Category="Game|Damage")
FTakeAnyDamageSignature OnTakeAnyDamage Examples
Deduct damage from a Health variable when this actor takes any damage
Blueprint
Bind in C++ to react to any damage C++
// In BeginPlay or constructor
OnTakeAnyDamage.AddDynamic(this, &AMyActor::HandleAnyDamage);
// Handler signature
void AMyActor::HandleAnyDamage(AActor* DamagedActor, float Damage, const UDamageType* DamageType, AController* InstigatedBy, AActor* DamageCauser)
{
UE_LOG(LogTemp, Warning, TEXT("Took %.1f damage"), Damage);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?