RealDocs

AActor::HasDataLayers

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

Description

Returns true if this actor belongs to at least one data layer. A lightweight alternative to calling GetDataLayerInstances() just to check for membership.

Caveats & Gotchas

  • HasValidDataLayers() is an alias deprecated since UE 5.1 — use this function instead.
  • Returns false for actors in non-World Partition levels, even if the actor has entries in its DataLayers/DataLayerAssets arrays, because those arrays are not resolved without a World Partition context.

Signature

ENGINE_API bool HasDataLayers() const;

Return Type

bool

Example

Early-out when actor has no data layer assignments C++
if (!MyActor->HasDataLayers())
{
    return; // No data layer filtering needed for this actor
}
// ... expensive data layer resolution below

Version History

Introduced in: 5.0

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

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.