How do I return type of TArray64 array in to Blueprint?

Yes it’s compiling if i removed macro. I kind of add little fix by converting TArray64 in to TArray by adding each element to TArray. Then I used return type as TArray and now it’s working fine with macros. There must be a better way to do this but this is fine for now. Thanks for the reply @knapeczadam

I’m using C++ and I have an byte array type of TArray64. I want to pass this array in to a blueprint. But when I try to pass it using UPROPERTY or UFUNCTION it gives me this error “TArray64 type must be a UCLASS, USTRUCT or UENUM”.

How do I fix this error? Please help! All I wanna do is get this TArray64 in to the blueprint.

ex:

UFUNCTION(BlueprintNativeEvent)
TArray64 OnImageComplete();

Probably if you remove the UPROPERTY/UFUNCTION macro it’ll compile.
(It’s a known bug(?): https://answers.unrealengine.com/questions/427309/view.html)

TArray64 is not only not supported by Blueprint but it seems as reflection system all toghther, so as knapeczadam suggested removing whatever oyu doing form reflection system will make it work.

You already figured you need to process it for blueprint, just remeber oyu can access array data not only via per element, for example you can get get pointer to raw array with GetData function and construct new TArray with this constructor by providing pointer that you get from GetData()

This will create new TArray for raw array in memory without processing or coping the data.

Before you do that call Shrink on TArray64 to make sure data is compacted in memory

Multiplay type size by number of elements to get size you need to need:

I suspect TArray64 is just 64-bit index version of TArray (which by look of it it’s just typed def of TArray with template 3rd argument), so it should keep compatibility. Only limitation is the size of array, it can’t take more then 4 milllion elements as that limitation of 32-bit array. Since you play with raw memory, i would also validate this method if you don’t have any corruptions by doing this, before putting this to product (or whatever you doing).

Also… i wonder… looking it is image related, are you sure this TArray64 will be even practical to use in Blueprints? Are you sure you don’t want to convert this to some UTexture or something?

1 Like

Thank you for the detailed answer @anonymous_user_f5a50610. I’ll try to do steps you provided and let you know the result. I have to develop a product which basically can control few cameras using a dashboard. Client specifically told to implement it using blueprint so that their designers can easily understand the code. But they added requirement to get the current camera preview (Like in a screenshot) using scene capture 2D and convert it in to a base64 string and storing in database.

This cannot be done inside only using blueprint ( or can it?). But previously I have worked on something like that in unreal 4.22.In there I used imageWrapper->GetCompressed() to get a TArray. But in 4.25 it returns a TArray64. I only just need a array of bytes which can encode it to a string. So it’s not necessary to convert it to a UTexture. Everything is works fine till i have to expose this functionality to blueprints.

Did you manage to solve this?

What i think I did was, I converted TArray64 into normal TArray then returned the newly created TArray. Normal TArray’s can be returned on blueprints as common data types.

How do you “Convert” it into a TArray… got the same Problem:

const TArray<uint8>& _ImageData = ImageWrapper->GetCompressed(100);
UTexture2D* MyTexture2D = UKismetRenderingLibrary::ImportBufferAsTexture2D((), _ImageData);
return MyTexture2D;

where ImportBufferAsTexture2D needs a TArray but GetCompressed returns a TArray64

A random Question. Can you explain to me what TArray64 is? TArray is basically an array. so why is ti TArray64? does it mean the size of the Array is 64Bytes? Thank you