Updating a texture by code at every tick?

So, this is something that I need badly now and it appears that anything I try hits the performances (FPS) big time, such as calling Texture2D::UpdateResources… a huge hit, same enqueueing a rendering command. I cannot believe that UE4 is so undocumented… but it appears to be the case: anybody can point me to the correct way to do it?

Wow, guys… no answers? Is this that difficult or even unknown? In another engine that I’m not mentioning to avoid starting the usual ridiculous debate, I can do it with just 2 simple lines of code without impacting FPS at all:


myTexture.LoadRawTextureData(myPixels);
myTexture.Apply();

There has to be a UE4 equivalent for it! I can’t believe it’s not there at all :confused:

This is what I’m trying now, but the time it takes is kinda crazy (the texture is 320 by 288, so not trying to do fancy stuff here:



if (dataArray.Num() == 0)
    return myTexture; // returns the unchanged texture

uint8* newTextureData = dataArray.GetData(); // Get the bytes from the array

// Create the region to be updated
FUpdateTextureRegion2D* region = new FUpdateTextureRegion2D;
region->DestX = 0;
region->DestY = 0;
region->SrcX = 0;
region->SrcY = 0;
region->Width = sizeX; // this is 320
region->Height = sizeY; // this is 288
// Update the texture
myTexture->UpdateTextureRegions(0, 1, region, sizeX * 4, 4, newTextureData);


As a result, the texture frames are updated at 1 or 2 FPS, which is kinda crazy: what’s missing here? Any ideas?