- Home /
Unity UI. Flip a rawImage?
So I'm working on implementing a hardware camera feature on iOS (possible android too) Due to the many different screen sizes, I need the webCamTexture to scale to fit the screen without distortion(stretched texture). After some failures attempting this with a regular Plane (probably due to faulty code/formulae) it seems that the RawImage.SetNativeSize() method does exactly what I need.
However, the webCamTexture displays in mirrored form. On a plane I could just set the x scale to negative and be done with it. but on a RawImage that just flips the whole plane itself, making it invisible. So is there a way to render the RawImage image flipped? or can anyone supply the necessary code needed to do this with a plane?
Answer by Fattie · Feb 29, 2016 at 06:02 PM
I'm pretty sure you have to do it with the simple old
UVRect.
If I'm not mistaken it is 1-0--1-1 for a vertical mirror flip!!!
THANKS! I had to just change it to -1, 1, it was 1, 1 before!
Answer by subaiyalafzal22 · Sep 15, 2018 at 09:19 AM
Just rotate th object 180° on y axis in 2d and u will have ur rawimage flipped
Rotation is not synonymous to Image Flipping. What if you wanted the texture rendered on, for example, a convex or concave surface (or virtually any 3D object)? Or what if your image looks like this:
Use UVs ins$$anonymous$$d, since that's literally what the renderer (Direct3D, OpenGL) is using to map/tile the texture in the first place, even in "2D" (which is actually still 3D, as far as Unity's renderer is concerned).
Your answer
![](https://koobas.hobune.stream/wayback/20220613185554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Time Code Web Camera Image Capture 1 Answer
Check for Same Image 0 Answers
Setting RawImage's texture by script 0 Answers
Flip WebcamTexture vertically 1 Answer