C++ dynamic 3D array expose to blueprint?

Hi, does anyone know how I can make the dynamically created 3d c++ array accessible from blueprint? Or how the array should be re-written with UFUNCTION and TArray?

It depends a little on what you want.

Personally, I’d probably store the width, height and rgb in a struct, and then have an array of those structs. This plays well with UE4 and will allow you to access the data directly if you want. Alternatively you could keep your 3D array (but have it as a class member variable rather than locally scoped) and then access the data through UFUNCTIONS that are exposed to blueprints.

Thanks Phil, I appreciate the response.

I the first part of your response gives me some confidence that I was on the right track with a snippet from this link…

Multi Dimensional Arrays

To make a 2 or higher dimensional array,

wrap the array in a UStruct, and then make an Array of the UStructs.


struct FBMPImageData

TArray<FBMPStruct> BMPWidth;


//All BMP Pixels High
TArray<FBMPImageData> BMPHeight;


//Is there at least 1 pixel of height?
if(BMPHeight.Num() > 0)

//Display the RGB value of a pixel at y0,x0

In their example they are using fields,flowers and petals, where petals is clearly the value in a 2D array. I’m unsure how to expand
TArray BMPWidth; to add BMPRGBValue.

Keeping the 3D array and having it as a class member variable rather than locally scoped, then accessing the data through UFUNCTIONS that are exposed to blueprints sounds like an interesting idea but one that is out of my current ability. If this is the better option though I will get learning.

The ultimate aim is to be able to get the individual r,g,b values based upon their x,y in the array from blueprint that goes through all x,y’s from 0,0 to e.g 2047,2047 (i.e image resolution)