RealDocs

AActor::Owner

property Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UPROPERTYReplicatedUsing=OnRep_Owner

Description

The owning actor of this actor. Used primarily by the replication system for relevancy (bNetUseOwnerRelevancy, bOnlyRelevantToOwner) and by render components for owner-based visibility (bOwnerNoSee, bOnlyOwnerSee).

Caveats & Gotchas

  • Do not assign to this field directly — use SetOwner() and GetOwner() so that the engine's internal owner-change callbacks (OnRep_Owner, visibility invalidation) fire correctly.
  • Owner is replicated from server to clients via ReplicatedUsing=OnRep_Owner; assigning it on a client has no network effect and will be overwritten on the next replication update.
  • Circular ownership (A owns B, B owns A) will cause an infinite loop in HasNetOwner() and related owner-chain traversals.

Signature

UPROPERTY(ReplicatedUsing=OnRep_Owner)
TObjectPtr<AActor> Owner;

Example

Check actor ownership in gameplay code C++
// Prefer GetOwner() over reading Owner directly
AActor* OwnerActor = MyActor->GetOwner();
if (APlayerController* PC = Cast<APlayerController>(OwnerActor))
{
    // This actor is owned by a local player controller
}

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.