Why does my Dynamic 2D Texture Show Up Blank?

I’ve been trying to load up a dynamically created texture on a custom actor created as a plugin. Currently I can create a cube, load up my custom material and it shows up in the editor and game. If I then load up a 2D texture created dynamically (filled with noise so it is obvious it is being used) and set it on my material’a texture property it gets set but shows up as a blank grey or off-white. I’m using the method from the wiki to create and update the texture: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

Below is the relevant portion of the header:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = StaticMeshComponents) TSubobjectPtr<UStaticMeshComponent> schwein;

UPROPERTY(EditDefaultsOnly, Category = Materials) UMaterialInterface *MasterMaterialRef;

UPROPERTY() UTexture2D *DynamicTexture;

UPROPERTY() UMaterialInstanceDynamic* RV_MatInst;

Below is the relevant portion of the actor implementation:

// create cube
schwein = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("schwein"));

// load material
static ConstructorHelpers::FObjectFinder<UStaticMesh>StaticMesh(TEXT("StaticMesh'/Game/Shapes/Shape_Cube.Shape_Cube'"));
static ConstructorHelpers::FObjectFinder<UMaterial> goldMaterial(TEXT("Material'/Game/Ibex/DesktopMaterial'"));

// create my custom material
MasterMaterialRef = goldMaterial.Object;

RootComponent = schwein;

// create random noise for texture
const int SizeX = 1024;
const int SizeY = 1024;
static uint8 data[SizeX * SizeY * 4] = { 0 };
for (int i = 0; i < SizeX * SizeY * 4; ++i) {
	data[i] = rand() % 255;

// create dynamic texture
DynamicTexture = UTexture2D::CreateTransient(SizeX, SizeY);

// update dynamic texture
FUpdateTextureRegion2D r(0, 0, 0, 0, SizeX, SizeY);
UpdateTextureRegions(DynamicTexture, (int32)0, (uint32)1, &r, (uint32)(4 * SizeX), (uint32)4, data, false); // Using the UpdateTextureRegions from https://wiki.unrealengine.com/Dynamic_Textures

// update texture property on material and set object to use material
RV_MatInst->SetTextureParameterValue(FName("T2DTexture"), DynamicTexture);

schwein->SetMaterial(0, RV_MatInst);

Interestingly enough it works now! I had code inside my actor’s tick class that got called once to initialize the texture with


If I just run the function on each update it works which means that the world wasn’t initialized on the first tick. Is there a recommended way of checking to know when one can start creating and updating textures?

I’m having the same problem. Can you provide a bit more detail about how you were able to solve this? TIA.

Are you saying you called:

In your tick function? Or are you saying you called the function defined in:

I have been working with this Dynamic Textures function. I made a slight modification to the code to ensure that the texture is ready to use:

if (Texture && Texture->Resource)


if (Texture->Resource)

I found this removes some of the instability and ensures that the update function is only doing work when there is a texture to work upon