{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Set Life Span in Unreal Engine 5 C++UE Docs

The Set Life Span Blueprint node is AActor::SetLifeSpan in C++. Calling SetLifeSpan(5.0f) schedules the actor to be destroyed automatically after 5 seconds.

Blueprint node & C++ equivalent

C++
SetLifeSpan(5.0f);   // auto-destroy after 5 seconds

What does the Set Life Span node do?

Set Life Span tells the engine to destroy the actor after a given number of seconds. It is a convenient way to clean up short-lived actors such as projectiles, decals, particle effects, or temporary spawned objects without managing your own timer.

Passing 0.0f clears any pending life span so the actor is no longer scheduled for destruction.

The C++ equivalent

Call SetLifeSpan(5.0f); to destroy the actor after five seconds. The value is in seconds and counts down from the moment of the call. Internally this sets a timer that triggers Destroy() when it elapses.

You can also set the initial lifespan in the constructor via the InitialLifeSpan property, which applies automatically when the actor spawns.

When to use it in C++

Reach for SetLifeSpan whenever an actor should remove itself after a fixed delay and you do not need to do anything else at destruction time. If you need custom cleanup logic at the moment of destruction, override EndPlay or bind a FTimerHandle instead so you can run code before the actor is removed.

Frequently asked questions

How do I auto-destroy an actor after a few seconds in UE5 C++?+

Call SetLifeSpan(Seconds) on the actor. For example, SetLifeSpan(5.0f) destroys it after 5 seconds.

How do I cancel a life span in C++?+

Call SetLifeSpan(0.0f) to clear the pending destruction so the actor stays alive.

Related AActor nodes

View all AActor nodes →