TArray of UStruct of dynamic size as an editable UProperty

I’d like to use a TArray of a UStruct as an editable UProperty in Blueprint. Like so.

USTRUCT()
struct FSomeStruct()
{
    float thingToEdit;
}

UCLASS()
class ASomeClass()
{
   UPROPERTY(Editanywhere...etc)
   TArray<SomeStruct> Structs;
}

The current issue I’m having is that when create a Blueprint from SomeClass and go to add a struct to the array in the Defaults pane is comes up with 0 elements. I’d like for it to add a new element to the array dynamically and allocate it at that time. Is this possible?

Completely possible - you just need to make sure your struct’s properties also have a UPROPERTY() with EditAnywhere, EditDefaultsOnly, etc. as well in order for them to show up in the editor.

Yes by default (you can disable that) you should have + symbol to add element to array

Works perfectly thanks!

#The Correct Code

The final correct code should actually look like this

USTRUCT()
struct FSomeStruct()
{
    UPROPERTY(EditAnywhere,BlueprintReadWrite,Category("thingToEdit"))
    float thingToEdit;

    FSomeStruct()
   {
       thingToEdit = 0;
   }

}
 
UCLASS()
class ASomeClass()
{
   UPROPERTY(EditAnywhere,BlueprintReadWrite,Category("YourCategory"))
   TArray<FSomeStruct> Structs;
}

I posted this mainly for future viewers

's code but UE 4.6+ compliant (his version was not compiling)

USTRUCT()
struct FSomeStruct
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(EditAnywhere,BlueprintReadWrite,Category ="YourCategory")
    float thingToEdit;

    FSomeStruct()
    {
        thingToEdit = 0;
    }
};

UCLASS()
class ASomeClass
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere,BlueprintReadWrite,Category = "YourCategory")
    TArray<FSomeStruct> Structs;
}