RealDocs

AActor::GetOwner

function Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableconst

Description

Returns the actor that owns this actor, or nullptr if there is no owner. Used primarily to navigate the ownership chain for network relevancy and RPC routing.

Caveats & Gotchas

  • The templated overload GetOwner<T>() performs a Cast and returns nullptr if the owner is not of type T — use it to avoid a separate Cast call when you know the expected owner type.
  • The owner is not a replicated property itself — it is transferred as part of the actor channel setup. Do not assume the owner is available in PreNetReceive on the client.
  • Walking the owner chain manually (while (Actor = Actor->GetOwner())) can loop indefinitely if a circular ownership chain exists. Guard with a visited set or iteration limit in production code.

Signature

AActor* GetOwner() const;

Return Type

AActor*

Example

Finding the owning PlayerController via the owner chain C++
APlayerController* AMyActor::GetOwningPlayerController() const
{
	AActor* CurrentOwner = GetOwner();
	while (CurrentOwner)
	{
		if (APlayerController* PC = Cast<APlayerController>(CurrentOwner))
		{
			return PC;
		}
		CurrentOwner = CurrentOwner->GetOwner();
	}
	return nullptr;
}

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.