Hello! In fact if you already have pixels color array, then all you need is just texture2d variable and thats all. To write data to it you can use this code
if (auto MipData = Texture2DVariable->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE)) {
FMemory::Memcpy(MipData, screenShotData.GetData(), screenShotData.Num() * sizeof(FColor));
}
Texture2DVariable->PlatformData->Mips[0].BulkData.Unlock();
Texture2DVariable->UpdateResource();