Well with unity3D, I am in big trouble whenever I use sprites. As for textures I compensate for a evener look by Stretching it (Screen.width & Screen.height- that's fine for low end 2D games). Now If I have an Image and based on content of Image (Let's say I want to add BoxCollider for the walls in image). It works, but for only one aspect ratio. As I am making game for Android. I am having bunch of different resolution & Aspect ratios. Is this possible to stretch my coliders or other game objects so that I can Work easily???? please help me. I am in a rush :(
I have a 'full width UI' script that deduces the aspect ratio of the screen relative to some reference screen dimensions, and adds a scale to the transform to compensate for a change in aspect ratio. Then I build my UI to the reference screen dimensions (in my case 1024 x 768). At runtime, the actual screen width is asked for, and the adjustment ratio calculated. E.g. if the screen width is 1280, then a ratio of
1280/1024 = 1.25 is needed. That ratio is set as a scale along the x axis on a transform which is the parent of all of my UI, effectively stretching it horizontally until it occupies the whole screen.
NB: This is separate from the code which scales the entire UI to fit the resolution (e.g. if the screen was set to 800x600 instead of 1024x768, then my UI needs to be scaled down by 0.78125 in both axes to occupy the same space. In practice, I handle that part by altering the camera projection, but I call it out because changing the aspect ratio is a separate thing than changing the resolution (because the latter needs to preserve the aspect ratio, not alter it).