Can I Change The X Size And Y Size Render Target at Runtime?

Conserving the info? or just resize?

Resizing is easy, inside the UTextureRenderTarget2D you have a function InitAutoFormat(), check how the CreateRenderTarget2D function is made UKismetRenderingLibrary::CreateRenderTarget2D:

	NewRenderTarget2D->RenderTargetFormat = Format;
	NewRenderTarget2D->ClearColor = ClearColor;
	NewRenderTarget2D->bAutoGenerateMips = bAutoGenerateMipMaps;
	NewRenderTarget2D->InitAutoFormat(Width, Height);	
	NewRenderTarget2D->UpdateResourceImmediate(true);

Now if you want to resize and keep the texture data, that is a different story, you will need to create first a temporary texture, copy your texture there, resize your original texture and copy back, It should be trivial to do with DrawMaterialToRenderTarget.

3 Likes