- Home /
Unity 4.6 GUI - Stretch/scale while rotated
I am having an issue where I have a Rect that is rotated 90 degrees and I want to make it scale along with the Canvas. I have set up the anchors just like I did with the non-rotated rects but when the canvas stretches horizontally, the rect stretches vertically and vice versa. This only happens with the rects that are rotated.
I have tried inverting the anchors (putting each anchor on the opposite corner, which gives it a slightly different effect but not the standard stretch/scale I'm looking for.
For certain reasons, I can't just leave the rect with no rotation and change the dimensions to make it look like it's rotated, which so far is the only way I've been able to make it scale properly.
Has anyone else encountered this or have any idea what I can do?
I'm not 100% sure what you mean here, I've put a panel on a canvas, and rotated the panel 45%, if I scale the canvas everything works as expected. Are you able to create a simple scene, and upload it here?
Ok but if you rotate it 90 degrees so that it's sideways and then stretch the canvas horizontally, the "width" of the panel stretches when I want the "height" to stretch.
Answer by Ryujose · Oct 10, 2014 at 06:04 PM
I'm not sure if I understood but maybe when you rotate 90 degrees. Canvas detect width when teorically is height and height when is widht?
Hope is that.
Yes it is that, I just wanted to know if there was a way to change it.
I asked a similar question at http://answers.unity3d.com/questions/927105/simple-way-to-fit-rotated-ui-element-to-parent.html Worked out an answer for myself which might work for you
Answer by Mulik · Aug 25, 2017 at 01:23 PM
First rotate as you want 1. set anchor to stretched 2. swap min x and max x 3. swap min y and max y
Your answer
Follow this Question
Related Questions
Unity 4.6 ui scroll rect won't show up in fullscreen 1 Answer
Unity 4.6 UI - How to left-align scroll rect content 3 Answers
Oculus Rift virtual keyboard 0 Answers
Unity New GUI Buttons not resposive on Touch 1 Answer
How can I make a Unity 4.6 UI object trigger when I drag something onto it? 1 Answer