Download

Cant make a a Texture Array at runtime?

Does anyone know how to create a new texture array at runtime?
I have tried this:


UTexture2DArray* textureArray = NewObject<UTexture2DArray>();
UTexture2D* tex0 = UTexture2D::CreateTransient(104, 104, PF_B8G8R8A8);
tex0->UpdateResource();
textureArray->SourceTextures.Add(tex0);
textureArray->UpdateSourceFromSourceTextures();


This does indeed make a new texture array, and it does indeed add a new transient texture to the array.
However I think I am doing something wrong, as the texture array’s image and thumbnail is always blank. I am getting crashes trying to use it.

I also have tried modifying an existing texture array (without success). I get the same issue, the texture slots in the textureArray UI window change, but the actual texture array stays the same.