Can you make 2D arrays in C++? If so, how?

I’m surprised that I couldn’t find a single video, post, or other form of information on how to create Unreal Engine 2D arrays in C++. I couldn’t even find anything saying definitely whether or not it’s possible. Can someone help me out?

Thanks in advance!

If you mean a multidimensional array, I believe you can if you don’t plan on exposing them in the editor using UPROPERTY(). Otherwise if you are using it purely in C++ I think you can do something like TArray<TArray<int>> foo;

Otherwise if you need to expose them to the editor, the closest thing I could find was using a struct.

1 Like

Thanks for this, i have read so many posts saying it can’t be done in C++ and to use structs. I just tried this with a 3D array and it appears to work fine, i guess i’ll run into problems when i find out further down the line i need to expose it to blueprint!

No problem! Glad it helped out.