Render some UI elements into a texture

Hi,

Is there a way I can render chosen UI elements into a texture? I would then use this texture to save to disk and upload to various services. I have tried to think of a way to do this but I cannot find a solution. Any help is appreciated.

Adam

Yup, just create a separate camera outputting to a Render Texture, and have it render a specific canvas.
no different to other Render Texture camera implementations.

And of course you can do it the other way round, by assigning a RenderTexture texture to a RawImage on a UI canvas.

1 Like

Thanks for the help :slight_smile: Ill give it a try tonight!

Thanks again for the help! This seems to be the best option. I am going to implement the full solution this evening hopefully.

1 Like

Sorry for necro reviving this, but it’s getting frustrating. Would like to know if there are best practices to:

  • Handle the CanvasScaler of the camera for when the camera texture size doesn’t match the original camera size.
  • Handle Raycasting events under the same circumstances (buttons, clicks, etc won’t work properly).

For the first one, found somewhere where it’s advised to create a Component that inherits from CanvasScaler and modify HandleScaleWithScreenSize() (but no proper instructions of what to put inside there… I’m assuming SetScaleFactor(flot scale) method.)