Set UPROPERTY specifiers for members of TArray

Is it possible to set UPROPERTY specifiers for TArray members (derived from UObject)?

UPROPERTY()
TArray<UArrayMember*> classAttribute;

I’d like to have instances of UArrayMember (created with NewObject()) to be recognized as UPROPERTY(EditAnywhere) to be able to edit its exposed attributes in the Unreal editor.

At least the Garbage Collector might recognize UArrayMember according to the documentation:

TArrays have the added benefit of having their elements garbage collected. This assumes that the TArray is marked as a UPROPERTY, and that it stores UObject derived pointers.

but when using UArrayMember inside TArray I’m not able to set UPROPERTY specifiers. So I’ve tried using a struct as wrapper:

USTRUCT()
struct FArrayMemberWrapper
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UArrayMember* arrayMember;

	/*! For Garbage Collector.
	*/
	void Destroy() {
		arrayMember = nullptr;
	}

	FArrayMemberWrapper() : arrayMember(nullptr) {}
};

and using instances of the struct in TArray of my AActor derived class:

UPROPERTY()
 TArray<FArrayMemberWrapper> structContainerForArrayMember;

However when clicking on the instance of UArrayMember then the UE4 editor still shows Native components are editable when declared as a property in c++, so the attributes are not editable. Does anyone have an idea what I’m doing wrong?

Nonsense idea

I’ve also tried the idea written here,

UPROPERTY()
UArrayMember* test;
UPROPERTY()
TArray<UArrayMember*> classAttribute;

but as expected the instances of UArrayMember are not recognized as UPROPERTY by Unreal editor as well (since there is no connection between test and members of classAttribute).

I was on the right track using an UStruct() as wrapper. I’ve just looked at the wrong place for editing its attributes in Unreal Editor.

Instead of selecting UArrayMemberComponentName (Inherited) in the details panel, I have to expand the TArray of the AActor(Instance) to be able to edit the attributes of UArrayMember.

I’m just wondering why this distinction is made by Unreal Editor because both ways of “views” in the details panel are pointing to the same object (I’ve tested it with modifying attributes values and the change was reflected when clicking on UArrayMemberComponentName (Inherited), too).

I know this is an oldie, but I am wondering how to do the same thing. I have an array of bytes (uint8) and wanted to add the meta property ‘NoSpinbox = true’ to each item. The spin box covers up the last digit on my editor, making the numbers unreadable.

My current solution:

USTRUCT(BlueprintType)
struct Fuint8
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Data File", meta = (NoSpinbox = true))

    uint8 Data;
};

USTRUCT(BlueprintType)
struct FTreeBlockStructure
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Data File")
    FString Name;

    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Data File", meta = (NoSpinbox = true))
    int32 Size;

    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Data File")
    TArray<Fuint8> Data;
};

void AMyFileActor::ReadData(char* cDataFileName)
{
    char* ReadData;
    ReadData = (char*)malloc(FileData.Size + 1);
    myFile.read(ReadData, FileData.Size);
    for (int j = 0; j < FileData.Size; j++)
    {
        Fuint8 newChar;
        newChar.Data = ptro[j];
        FileData.Data.Add(newChar);
    }
}

This works, but it’s not ideal. I need to add a new element to my data structure. So now instead of FileData.Data[i], I need to have FileData.Data[i].Data. And I can’t just fill the array with Append, I need a for loop and add each element manually.