AActor::SetNetDormancy
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintAuthorityOnlyBlueprintCallable
Description
Sets the network dormancy state of this actor. Dormant actors are excluded from the replication loop until woken, reducing server CPU and bandwidth costs for static or infrequently-changing actors.
Caveats & Gotchas
- • BlueprintAuthorityOnly — calling this on a client has no effect and produces no error. Only the server drives dormancy state.
- • Transitioning to DORM_DormantAll flushes a final replication pass to all connections before the actor goes dormant — this is a brief bandwidth spike.
- • If you modify a dormant actor's replicated properties without calling FlushNetDormancy first, clients will never receive the update until the actor is woken.
- • DORM_Initial is special: the actor starts dormant and will wake on the first relevant connection — use this for level-placed actors that start inactive.
Signature
ENGINE_API void SetNetDormancy(ENetDormancy NewDormancy) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewDormancy | ENetDormancy | The new dormancy state to apply (e.g., DORM_Awake, DORM_DormantAll, DORM_DormantPartial, DORM_Initial). | — |
Return Type
void Example
Put a static destructible actor to sleep after it has been activated C++
void AMyBarrel::OnExplode()
{
// Wake the actor so the explosion state replicates
SetNetDormancy(DORM_Awake);
bExploded = true;
// After a delay, put it back to sleep — it won't change again
FTimerHandle TimerHandle;
GetWorldTimerManager().SetTimer(TimerHandle, [this]()
{
SetNetDormancy(DORM_DormantAll);
}, 2.f, false);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?