Create UI::Button from RenderTexture

Hello, I need to create a button from a RenderTexture. This seems like it should be a rather basic task, but I am finding no luck online or within the engine itself. There seems to be no way to create a UI::Button without loading the image from a file. Is this really the case? I guess I could save my RenderTexture to disk and then re-load into a UI::Button, but that seems like quite a hack and will be quite slow (hard drive accesses) when I have many of these on screen at once.

What is the proper way to do this?
Thanks in advance,
-Mark

Have you tried?

  1. SpriteFrame::createWithTexture(Texture2D* pobTexture, const Rect& rect);

  2. Button::loadTextureXXXXXX(SpriteFrame* mySpriteFrame)

Yes, a form of this works for me. Thank you!