- Home /
Use the canvas scaler to resize UI on a RenderTexture's resolution ?
Hi everybody,
I am currently trying to create a screenshot tool for mobile, implying that I have to do multiple screenshots for multiple resolutions. Application.CaptureScreenshot beeing to slow and not convenient at all for my use, I tried the "RenderTexture technique" to redirect the rendering frame of my camera into a texture and then saving it. That is working well, the only exception is that the UI originally did not render on these screenshots. I resolved that problem by changing my UI from Overlay to Camera space.
And here is my problem : The screenshots I save while doing this don't have the same resolutions as the current game window, so my Canvas Scaler doesn't resize the UI Canvas to fit these resolutions. It feels like the camera will render properly when you give it a RenderTexture with a specific resolution but the Canvas Scaler still uses the screen space to scale the UI, and not the destination resolution of this RenderTexture.
Does anyone know something about it or have any tips for manually resizing a Canvas to fit to a specific resolution, or maybe just a deeper knowledge of how to scale a Canvas Scaler with a script ? Just to be clear, my goal here is to make a Canvas (or a Canvas Scaler) fit a specific resolution that is different from my game window resolution.
Thank you in advance guys !