- Home /
Scaling On Different Devices Issue
I recently finished my game and am running tests on different devices preparing for release on the app store. The game is set in landscape mode and cannot be played in portrait mode. The game runs perfectly on my iPhone 6. I tried the iPad Pro (biggest screen possible) and it looked horrifying. Sprites, buttons, and images were not the right size or in the right places. Also one of my scenes has 4 box colliders - one right, left, top, and bottom to allow a ball to bounce within the screen - the left and right colliders were further left and right compared to the screen (so the ball would go off screen before making contact with the collider. Some sprites were really big and others smallI did a bunch of research and have tried many things, but am still struggling. Here's what I tried:
1) Made sure I set the canvas in every scene to scale with screen size (height and width = 0.5). 2) Tried changing the scale with screen size dimensions (currently at 800 X 600). 3) Made a new project and imported all assets and rearranged what was off - this worked great on iPad (I use a 4:3 compared to free aspect in my other project), but when running on iPhone some of the buttons don't scale right and my sprites and animations (like title text dropping down when scene switches) are off. 4) I also tried utilizing this code, but had no luck after attaching scripts to main camera - http://gamedev.stackexchange.com/questions/79546/how-do-you-handle-aspect-ratio-differences-with-unity-2d 5) Also used anchors on all UI elements and for the most part buttons are scaling alright, but everything else goes haywire.
This is so frustrating! Is there a way to have all your assets, sprites, images, and buttons stay in the same position regardless of the device it's run on? Like just take the iPhone 6 version and write some code to stretch all scenes to match iPad dimensions. If there is anything that is unclear in my question or if you need screenshots I will update my post asap. I would appreciate any help.
Have you read this? https://docs.unity3d.com/$$anonymous$$anual/HOWTO-UI$$anonymous$$ultiResolution.html It sounds like your anchors aren't all set correctly, and you might need to add the Canvas Scaler component.
Your question isn't very clear - what does "everything else goes haywire" mean? Is it non-UI objects that you're having trouble with now?
Thanks for the reply. I have gone through that tutorial and that covers UI. The UI is not much of problem, but I do have some sprites in my scenes. I am going to try and change as many of my sprites into images as possible. The biggest concern I have though is about the box colliders I have set up on the edges of the screen. I created a new version of my game to fit a 4:3 ratio and it runs great on iPad Pro, but when I run it on my iPhone 6 the box colliders move in and it looks like the ball is bouncing off of invisible walls. What could I do about that? Also I have some animated sprites that I'm not entirely sure I can convert to images (I will do more research on this now). If I can't convert the animations to ui image, how can I anchor the animations position to, for example, the bottom left corner?