I am making an Android game for a tablet (Asus transformer) and a phone (Motorola Droid Razr). My question is about scaling and aspect ratio. I deploy to the phone and it works fine. I deploy to the tablet and i have some coordinate issues where screen.height is odd but it still works. My problem is that in the current system i have in place some parts of the images and hud are cut off because of how it scales from 960 by 640 to 1280 by 800. How do i properly scale my game to fit different phones and different tablets with odd aspect ratios? I dont want to have black space where nothing is drawn but I want it to scale to the screen. Is this possible to scale something with unity to work with a lot of devices? What code is needed? I want to avoid stretching the width and height independently because the game I am working on depends on the 2d images being exact across phones and tablets.
Thanks
if you don’t want stretching and don’t want black borders and alike, you need to create distinct layouts and use the right one depending on the aspect ratio and screen size.
There is no way around that
So is it like creating a different layout for ldpi, mdpi , and hdpi android screens to take advantage of their size? What would you recommend? What do professional android users do? Do they do a one size fits all system or do they use what you said where you have many layouts and decide on which one? I wonder because it seems like there are so many layouts.
Thank you for responding
[edit] I read somewhere on stackoverflow they one should approach this like making a computer game. But dont computers have set aspect ratios? Or is it really similar too?
We dealt with this issue in a number of ways. We intended to start in the Android market, then we wimped out and went to Apple. This reduced the supported resolutions from somewhere near infinite to three. The 3GS, the 4th generation (which is exactly the same aspect ratio) and the iPad. Then there are some very sophisticated ways of dealing with the size of your UI, but we didn’t use them. We went with a simple two tiered approach of low res or not and rendered those elements in two sizes 64 x 64 and 128 x 128. We load the larger ones on demand if you have a higher res device. As we added the achievements and such we went with a four camera system including a billboard projection with an orthographic camera which is set to half the screen height. Finally a lot of the layout is done in floating point i.e 10% of the screen or whatever. It’s starting to look good on my Android but I’m still a little freaked out about going to that market.
I just got done working through this. As far as world space goes, 3d, you need to stop thinking in terms of pixels, its all about dealing with different aspect ratios. If you want your game to run on any device you have three choices, either create different layouts for various AR’s like 1.3 1.5 1.7 etc and you will have very small dead space, or create one size fits all layout and have very large dead space vertically or horizontally on some devices, or you can stretch everything, the last I wouldn’t recommend.
The other consideration is pixel density which if you want crisp nice looking textures on all devices you will need different resolution resources.
I must have read this a half dozen times, it explain this all very well.
http://developer.android.com/guide/practices/screens_support.html