DynamicTexture to GUI.Image without toUrl?

Is there anyway to avoid converting a dynamic texture toDataUrl to get the content to a GUI.Image?

Right now I have a pretty complicated UI element that is being generated every two frames that the only real way to achive the looks is by using a DynamicTexture. After the DT updates I then dump the results to a new GUI.Image replace the old Image and dispose it. Its highly intensive and I would much rather just be able to do the DT.update() and have the results propagate to the UI instantly.

Any ideas?

well, DynamicTexture internally uses a canvas, so you can set this canvas as the source of your image (or at least directly copy it onto the GUI element)

I actually ended up drawing to the ADT directly doing that method, it is kind of hackey the way I am doing it.

Can you please show me an example where you draw directly to a position able element?

Can you elaborate a bit more>?

I am able to draw directly on the ADT, but I am having trouble positioning it like an element. And there there seems to be a flicker too on the manually drawn elements when I do things like a globalAlpha with the drawing of the context.

Basically I was hoping it would be possible to make a custom draw method for a GUI element.

The best idea is to create your own control so you inherit from all the goodness of the system and you only have to override the draw function

This ended up working way well and was super simple!

1 Like