- Home /
Preserve aspect ratio of UI elements, not just image inside it. (4.6 UI system)
Hi, I'm trying to work out a UI with the new UI system in Unity 4.6 Beta. But I can't seem to get it to scale in the way that I want.
I have a UI set up as I want it, as you can see in the screenshot. Now I want to make it scale with the display. Right now as I get a bigger resolution, the interface eventually becomes a tiny dot in the top right corner.
So I tried adjusting the anchor of my panel which has the wood as a background image to stretch with the right side. BUT, as I have conserve aspect ratio turned on, the items in it don't receive the correct information. ( see screenshot 2) Try as I might, I cannot seem to get the right setup of anchors and pivot points to have the items in my inventory to move along with the boxes.
Is there a way to or a different UI element that keeps the rect fixed to the image inside it? So not just keep the aspect ratio of the image inside it, but of the entire element.
[1]: /storage/temp/33204-unityissue2.jpg
Answer by lioralterman · Oct 06, 2014 at 11:08 AM
You have to drag only the bottom left triangle of the anchor point like in this image: and then it will resize according to the resulotion.
Is there any way to do this easily? I'm thinking like a button to do this for you or anchor mode?
Answer by Umresh · Dec 27, 2014 at 09:55 AM
You can click on the Left box in Rect Transform which shows the anchor points and select the stretch if you want to resize the image on other resolutions.