Dynamically allocating a UUserDefinedStruct?

I’ve got a blueprint function library function with the following signature:

UFUNCTION(BlueprintCallable)
static bool LoadSequenceTransforms(const FString& sequenceName, TArray<UeKeyedTransform*>& transforms);

The function looks like this:

bool USequenceSaverFunctions::LoadSequenceTransforms(const FString& sequenceName, TArray<UeKeyedTransform*>& transforms)
{
	UeKeyedTransform* transformStruct = new UeKeyedTransform();
}

Compiles just fine, but when trying to new off transformStruct the editor crashes and I get the following error:

FObjectInitializer::Get() can only be used inside of UObject-derived class constructor.

If I can’t use new to dynamically allocate memory for a UUserDefinedStruct, then how am I supposed to construct it?

Thanks!

Not an answer, but TBH, you should reconsider trying to work with UUserDefinedStructs in C++. It’s really not what they’re meant for, and are extremely difficult to access and set data from C++. I went down this road a few months ago trying to build a partially-automated save system, and all I found was failure and stories of other people trying to use these and failing - including people trying to build plugins with code support from Epic. UUserDefinedStructs are horrifyingly complicated beasts.

What I ended up doing was creating a UObject which contained FName-indexed TMaps for each of the common data types. That way, end-users could define custom data they needed to save in editable arrays or via accessors. This data was then either trivially easy to serialize, or in the case of UObjects, I could easily do my own cleanup to convert object pointers into a format which would survive save/load.