UpdateTextureRegions gives wrong results (SOLVED)

What I try to do:

I am trying to update a Texture every Frame because one of my Materials needs it.
Using the following code works fine in Editor but doesn’t work at all in a packaged game.
Mip.BulkData.Lock( LOCK_READ_WRITE );
// …
Mip.BulkData.Unlock( );
Texture->UpdateResource();

That is why I followed this tutorial: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
I copied the code from the section ‘Dynamic Texture & Dynamic Material’,
modified the Colors using this code:

	int pixelAmount = mDataSize / 4;
	for (int i = 0; i < pixelAmount; ++i)
	{
		int b = i * 4 + 0;
		int g = i * 4 + 1;
		int r = i * 4 + 2;
		int alpha = i * 4 + 3;

		mDynamicColors[r] = 255;
		mDynamicColors[g] = 255;
		mDynamicColors[b] = 255;
		mDynamicColors[alpha] = 255;
	}

And finally applied the changes:

mDynamicTexture->UpdateTextureRegions(0, 1, mUpdateTextureRegion, mDataSqrtSize, (uint32)4, mDynamicColors);

mDynamicMaterial->SetTextureParameterValue("LightLookupTexture", mDynamicTexture);

Now the Texture and the Material properly update even in a packaged project.


The Problem:

The texture has strange artifacts. In the first picture, I set r, g, and b to 255. In the second picture, I set everything to 0.

295090-result-purewhite.png

295101-result-pureblack.png


Please help!

In 2 years of programming, this is the first time I submitted a question to a forum. I spent already around 10 hours trying to make this code functional in a packaged project and I am at a total loss. Any help and suggestions are much appreciated! Thank you.

The error vanished after I set the LODGroup of the texture to Pixels2D.

mDynamicTexture->LODGroup = TEXTUREGROUP_Pixels2D;

Hope this will help someone in the future!