Skip to main content

Readable Structure Arrays

Use the TitleProperty metadata to show a struct member's value as the header of each array element in the Details panel.

Published Updated |
C++
Variables

Seeing the number of members in a structure array item isn’t overly helpful. Thankfully, when you’re dealing with them in C++, there’s one easy solution: the TitleProperty metadata specifier.

When declaring the UPROPERTY for the structure array, you can set TitleProperty to one of the struct’s properties, and each element’s header shows that property’s value instead of “3 members”.

For example, using the ItemName property as the TitleProperty makes each element display its item name.

UPROPERTY(EditAnywhere, Meta = (TitleProperty = "ItemName"))
TArray<FItemData> Items;

You can show multiple properties by surrounding each property name with curly braces. Anything outside the braces is printed as-is, so you can add your own separators or labels.

UPROPERTY(EditAnywhere, Meta = (TitleProperty = "{ItemName} {ItemQuality}"))
TArray<FItemData> Items;

Full example

/** The information of the item. */
USTRUCT(BlueprintType)
struct FItemData
{
    GENERATED_BODY();
 
    /** The name of the item. */
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    FName ItemName;
 
    /** The description of the item. */
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    FText ItemDescription;
 
	/** The quality of the item. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FText ItemQuality;
 
    //..
};
 
/** A Data Asset that holds the array */
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class UInventoryManager : public UActorComponent
{
    GENERATED_BODY()
 
    /** The items contained in the inventory. */
    UPROPERTY(EditAnywhere, Meta = (TitleProperty = "{ItemName} {ItemQuality}"))
    TArray<FItemData> Items;
 
    //..
};

Frequently asked questions

Why does the header say “Invalid Title Property!”?

The names in TitleProperty must match the struct’s C++ property names exactly. If any of them doesn’t resolve, the header shows Invalid Title Property! instead of a value.

How are enums displayed?

Each property is inserted using its display text, so enums show their display names rather than their raw values.

Which containers support it?

TitleProperty works on arrays of structs and on arrays of instanced object pointers. Sets and maps ignore it.

Can I search the array by its title?

Yes. When TitleProperty names a single property, the Details panel search also matches that property’s value, so you can filter a long array by item name.

Check out the following resources to learn more about the subject.

Unreal Directive is free and ad-free.

If it saved you time, you can help keep it that way.

Donate