- Home /
Rect Transforms not scaling the same?
I'm making a header for a scroll rect but the size of the pixels for the header is different from the content.
Example: The name header is 200px and so is the box underneath it, but they are not aligned. Also, the font size is the same (12pt) but they too are not aligned.
Any help would be appreciated! I'm suspecting it has to do with the canvas and how it's rendered differently from the rest of the gameObjects? The items for the scroll rect list are prefabs and added to the list at runtime.
Set render mode to "screen space camera". Your canvas will become the size of camera.
Then rect transform units will work as your require.
You say font is the same, 12pt, but in your screenshot the select is 20pt. If the other one is indeed 12, it would explain the size difference.
Answer by zxj001 · Nov 18, 2016 at 07:43 AM
Thanks for the replies. Turns out the canvas was not a scale of 1, so when i instantiate the text then add them as a child to the canvas, they are some other scale (1.102). Just needed to set the local scale to 1 after instantiation.
Your answer
Follow this Question
Related Questions
How to change the Top and Bottom (rect.yMin and yMax) properties of a rectTransform, in a script? 2 Answers
Help finding the right scale for an icon inside a backgorund sprite 1 Answer
Why does this not scale smoothly? Any Ideas? Transform.localscale 2 Answers
[Unity 4.6 Beta] Rect Transform Position (New UI System) 7 Answers
Questions about UGUI Rect Transform Anchors. How to make UI objects scale, correctly, with screen? 1 Answer