RealDocs

AActor::IsMainPackageActor

function Engine Since 5.0
#include "GameFramework/Actor.h"
Access: public

Description

Returns true if this actor is the primary actor of its containing package (i.e. it is not a Child Actor). Used to distinguish the top-level actor from sub-actors in packages that contain hierarchies.

Caveats & Gotchas

  • Child Actors return false because they are nested sub-objects of another actor, not independent package roots — serialization and asset-registry tools use this to find the canonical actor in a package.
  • This does not indicate whether the actor is a Blueprint — it is purely a package-structure query. A non-Blueprint actor placed directly in a level package can also return true.

Signature

ENGINE_API bool IsMainPackageActor() const;

Return Type

bool

Example

Skip child actors during iteration C++
for (TActorIterator<AActor> It(World); It; ++It)
{
	AActor* Actor = *It;
	if (Actor->IsMainPackageActor())
	{
		// Process only top-level package actors
	}
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.