Currently a UTexture2DDynamic can’t be used in a plugin because it has no methods exposed with the ENGINE_API so trying to initialize it with Init() causing link errors.
I could use FSlateTexture2DRHIRef for a dynamic texture but I don’t think I can plug that into a MID as a texture parameter.
What is the right way to create a dynamic texture, lock and write to it every frame, and plug it into a MID. Is UTexture2D::CreateTransient() a dynamic texture?
Hi there, this doesn’t address the real issue which is that an FTexture2DHIRef can’t be passed to a UMaterialInstanceDynamic to replace a texture input.
OK for this method to work you also have to call UpdateResource() on the texture. This destroys the underlying HRI texture resource and recreates it from scratch. This is very costly in terms of performance, definitely not suitable for the application in my original question which is doing this every frame.
I created a wikipage containing multiple solutions to this problem, the most performant one is first and lets you update subregions of the texture using ENQUEUE_UNIQUE_RENDER_COMMAND