RealDocs

UObject::GetOuter

function CoreUObject Since 1.0
#include "UObject/UObjectBase.h"
Access: public Specifiers: inlineconst

Description

Returns the UObject that directly owns this object in the outer chain. For an actor component this is the owning actor; for top-level assets this is the UPackage.

Signature

FORCEINLINE UObject* GetOuter() const

Return Type

UObject*

Caveats & Gotchas

  • Can return null for objects at the outermost level (UPackage objects). Always null-check unless you are certain of the outer chain.
  • Do not confuse GetOuter() with GetOwner() on AActor. GetOuter() is a UObject serialization/GC ownership concept; GetOwner() returns the gameplay owning actor.
  • The outer chain determines garbage collection lifetime. An object whose outer is GC'd will itself be GC'd.

Example

Walk the outer chain C++
UObject* Current = SomeObject;
while (Current)
{
	UE_LOG(LogTemp, Log, TEXT("%s"), *Current->GetName());
	Current = Current->GetOuter();
}

Version History

Introduced in: 1.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.