RealDocs

APawn::GetNetOwner

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Returns the actor that owns this pawn for network relevancy and replication purposes. Overrides the default to return the Controller when one is present, so that the pawn replicates under the controller's net relevancy.

Caveats & Gotchas

  • The returned owner drives which client has authority to send RPCs — if a pawn's controller is null (unpossessed), net ownership falls back to the default AActor::GetNetOwner() chain, which may route ownership through the Outer owner hierarchy.
  • Do not confuse net ownership with GetOwner() — GetNetOwner() is specifically for determining which client connection is authoritative for replication purposes and is unrelated to the actor attachment owner.

Signature

ENGINE_API virtual const AActor* GetNetOwner() const override;

Return Type

const AActor*

Example

Verify net owner before sending a client RPC C++
// The engine calls GetNetOwner() internally when deciding RPC routing.
// You rarely need to call this directly; it is used in checks like:
const AActor* Owner = MyPawn->GetNetOwner();
// Owner will be the controller if possessed, otherwise walk up the outer chain.

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.