Struct recursion via Arrays - unsupported, but why?

You can’t create an instance of a structure inside that very structure, it’s completely understandable, as such action would fill the entire memory recursively upon object creation.

However you also can’t create an array of a structure inside itself, even though the aforementioned problem doesn’t exist - upon adding an element to that array, a new empty array would be spawned inside the child object and that would be it.

Since that option is not available in Blueprints’ Structure creator, I tried to create the struct with C++:

USTRUCT()
struct FCorridorData
{
	GENERATED_BODY()

	UPROPERTY()
	uint8 Length = 0;

	UPROPERTY()
	TArray<FCorridorData> ChildCorridors;
};

However the compiler will throw an error:

Struct recursion via arrays is unsupported for properties.

But why? Having an ability to create child structures in property editor would enable nesting, useful in creation a lot of stuff, i.e. mazes or vent systems as tools for artists.

Still not available in 4.14.

This would also be recursive, as the child struct would itself contain an array and so on. My suggestion is to define your child struct separately and then include it in the FCorridorData struct.

The child struct would contain an array and this is exactly what I want. It won’t go to infinity (as in until it eats all the memory) because the array is empty by default - the chain ends unless you explicitly tell it to go one level deeper.

check this

class A
{
public:
	int32 AData;
	TArray<A> Children;
};

works well w/o reflection. But I can’t use replication for such data structures which is not convenient. Only RPC calls
or use another replicated array with data and in the tree save only indexes in this array