RealDocs

AActor::InitialLifeSpan

property Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UPROPERTYEditAnywhereBlueprintReadOnly

Description

How many seconds this actor lives before being automatically destroyed. A value of 0 means the actor lives forever. This is the initial value set before play begins and should not be modified after BeginPlay.

Caveats & Gotchas

  • This is the INITIAL value read at BeginPlay to call SetLifeSpan() — modifying it after BeginPlay has no effect. Use SetLifeSpan() at runtime to change the countdown.
  • The countdown is measured in real game time and respects global time dilation from WorldSettings; if TimeDilation is 0, the actor will never expire regardless of this value.
  • BlueprintReadOnly means Blueprint graphs cannot write to this field; to set it from Blueprint, use SetLifeSpan() instead.

Signature

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Actor)
float InitialLifeSpan;

Examples

Branch on whether the actor has a limited lifespan Blueprint
Event BeginPlay Branch Condition Condition True False Print String In String Actor has limited lifespan! Actor has limited lifespan! Initial Life Span Initial Life Span Initial Life Span > A B 0.0 Return Value Return Value
Edit Blueprint graph Branch on whether the actor has a limited lifespan
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Set a 5-second lifespan on a spawned projectile C++
AProjectile* Proj = GetWorld()->SpawnActor<AProjectile>(ProjectileClass, SpawnTM);
if (Proj)
{
    Proj->InitialLifeSpan = 5.0f; // Set before FinishSpawning or in constructor
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.