AActor::GetNetOwner
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualconst
Description
Returns the actor responsible for network replication decisions. By default returns the actor's Owner, but overridden in PlayerController and Pawn to drive bOnlyRelevantToOwner checks.
Caveats & Gotchas
- • This is distinct from GetOwner() conceptually — GetNetOwner() is specifically for the server-side relevancy system (ServerReplicateActors) and determines which connection owns this actor.
- • The default inline implementation simply returns the Owner pointer, so if Owner is nullptr the net owner is also nullptr, which means the actor replicates to all connections.
- • PlayerController overrides this to return itself, giving it authority over all replicated actors whose Owner chain traces back to that controller.
Signature
virtual const AActor* GetNetOwner() const Return Type
const AActor* Example
Check which actor owns replication responsibility C++
const AActor* NetOwner = MyActor->GetNetOwner();
if (NetOwner)
{
UE_LOG(LogTemp, Log, TEXT("Net owner: %s"), *NetOwner->GetName());
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?