How do I implement this code?

The code is already implemented… what you don’t know is how to use it…

But… this are pointers

here

here

here

They are not UObject so check all them using nullptr

if(MyPointer==nullptr)
{
     //invalid pointer
     return;
}

When you find the NULL punter then you need allocate memory for it…

i think the NULL pointer can be this
UTextureRenderTarget2D* Texture

but check all them anyway

This Array need a size too

TArray<FColor>& Array

the size is this

SizeX * SizeY * sizeof(FColor)

i’m not sure if Array = std::move(CommandData->DestBuffer); do this job or not… but i think not…
If not you need resize it before pass it to the function.

In other hand you have a asynchronous function… it can cause pointers problems too.
Make sure the code is bloking here untill the job is done!!

  // wait until render thread operation completes
    Future.Get();

Best regards!!

2 Likes