TArray of TArray support request

Will TArray of TArray (two-dimensional or three-dimensional etc. arrays) be supprted in engine (with exposing to blueprint)?

I think this feature will be great

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
TArray<TArray<int32>> array2d;

array2D[3][6] = 5;

Or there are technical limits in C++ language\reflection system?

Hi broly,

This is not something we are looking to add at this time. For one thing, there is no syntax for the specifiers of the inner array.

If you want an array within an array, you should wrap your nested array within a struct:

USTRUCT()
struct FInnerArray
{
    GENERATED_BODY()

    UPROPERTY(/* Inner specifiers */)
    TArray<int32> ArrayOfInts;
};

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
TArray<FInnerArray> array2d;

Hope this helps,

Steve

Hi Steve!
Sorry, but inconveniently and bulky. A lot of redundant code

This is reflection or VM limitation, UnrealScript in UE3 which blueprint use VM from it also had this limitation even thru syntax allowed to do so it showed you error. C++ can have native array of native array because C++… don’t really have array, they just pointers and index only offset memory address of varable.

You could use native array without UPROPERTY specially since you use it for int32, note that we not speaking here about C++ standard library arrays, i’m not sure if they support array in array but you could try to use them. You would need to make some functions to make such array usable in blueprint, but you could freely in C++. If you use such array with UObject pointers remember that it won’t be tracked by Engine so object will be subject of GC cleaning when they are not reference somewhere else

Thank you for detailed answer, Shadowriver!