Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Irin1178 on July 31, 2013, 12:48:05 PM
-
So story of my life here..
I went ahead and developed my game using NGUI's awesome anchoring solution. I love the way it looks, but of course, the client wants to see the game stretched on devices with wider resolutions now that its done. I guess all those widescreen tablets aren't floating their boat when it comes to empty space between my anchored UI elements.
Don't get me started on how ugly its going to look, but starting over is not an option. I was wondering if it is possible to tell the UICamera or something to stretch to fit the screen. I'm not looking to maintaining the aspect ratio or put bars on the side, I just simply want to develop in a given screen resolution (say 1024x768) and then stretch to fit the devices screen resolution.
I looked all over and couldn't find a relevant answer so I thought I'd ask the source.
Any ideas Aren?
-
Sure, just resize the UIRoot or the object underneath it. By default UIRoot is scaled to 2 / Screen.height for all 3 values (XYZ) if it's pixel-perfect. If I was adding this hack, I'd add a game object right underneath the UIRoot and parent the rest of my UI to it. This intermediary object would then be scaled on the X to something that would take the UI from its intended aspect ratio to something that would skew it, making it fill the screen.
-
Hmmm... well played Aren.. well played indeed.
Thanks for the help bud.
-
So i have this working with the hack you suggested, however the one issue I'm getting stuck on is that I have a panel that uses clipping in my scene. Its got an error on it stating that Clipped panels must have a uniform scale, or clipping won't work properly. However that panel with clip settings local scale is 1,1,1. It's the parent with the hack that does not have uniform scale since I'm only scaling the X as per the previous post.
Idea's on how to combat this?
-
You can't. Panels were designed to work with a uniform scale leading up to them. The issue is in the clipped shader itself -- that's just how it works. Unity's scaling is shearing in nature (scale an object, parent it to another scaled object, rotate the child -- you will see it getting skewed weirdly), and there is no "world scale" in Unity -- only "lossy scale" which is the direct result of this problem.
-
Is there a new or better way to handle stretch to fit now that 3.0 has been released?
-
Nothing has changed in this department in 3.0.
-
I am completely new to this, but I just had a similar issue that I fixed using UIStretch components. Is it possible to just add UIStretch to all the objects that need to scale, or to the parent object itself and tell it to FitInternalKeepingRatio? Or you could tell it to stretch horizontally to fit the screen width?