RealDocs

AActor::GetDataLayerInstances

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

Description

Returns all UDataLayerInstance objects this actor belongs to, resolving both the actor's DataLayerAssets list and any inherited parent data layers.

Caveats & Gotchas

  • The overload that takes an AWorldDataLayers pointer is deprecated since 5.1. Always call the zero-parameter version in current code.
  • This function resolves asset references at call time and can involve map lookups — avoid calling it in performance-critical loops. Cache the result if you need it repeatedly within a frame.
  • Only available at runtime when a UWorldPartition subsystem exists. In non-World Partition levels the returned array will always be empty.

Signature

ENGINE_API TArray<const UDataLayerInstance*> GetDataLayerInstances() const;

Return Type

TArray<const UDataLayerInstance*>

Example

List all data layer instances an actor belongs to C++
TArray<const UDataLayerInstance*> Layers = MyActor->GetDataLayerInstances();
for (const UDataLayerInstance* Layer : Layers)
{
    UE_LOG(LogGame, Log, TEXT("Actor is in data layer: %s"), *Layer->GetDataLayerFullName());
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable
5.0 stable Introduced with World Partition data layer asset system.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.