RealDocs

UActorComponent::GetAssetUserDataArray

function Engine Since 4.14
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualoverrideconst

Description

Returns a pointer to the internal array of all `UAssetUserData` objects attached to this component. Useful for iterating all attached user data without knowing the types in advance.

Caveats & Gotchas

  • May return null if the component stores user data lazily and none has been added yet — always null-check the pointer before iterating.
  • The returned pointer is to the component's internal array; do not cache it across frames as structural changes (add/remove) may invalidate it.

Signature

ENGINE_API virtual const TArray<UAssetUserData*>* GetAssetUserDataArray() const override;

Return Type

const TArray<UAssetUserData*>*

Example

Iterate all user data on a component C++
if (const TArray<UAssetUserData*>* UserDataArray = MyComponent->GetAssetUserDataArray())
{
    for (UAssetUserData* Data : *UserDataArray)
    {
        if (Data)
        {
            UE_LOG(LogTemp, Log, TEXT("UserData class: %s"), *Data->GetClass()->GetName());
        }
    }
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.