Resolution problem (477661)

I am building an app for a Sony tablet S and having troubles getting the resolution correct.:

http://store.sony.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=10551&storeId=10151&langId=-1&productId=8198552921666369293

The tablet display is at 1280 x 800 which I set my game window to match, and set all
the buttons and overlay assets to show properly according to that setup. The problem
is that when I export for android and load it on the tablet, the assets are not showing
where they are supposed to. I believe that if I could set the resolution in the player
settings for Android, it would remedy the situation since doing so for the web build
did fix the problem. But since I cannot, I tried to set the resolution in code using:

Screen.SetResolution (1280, 800, false, 60); in the start method of the Game object.

Can anyone help asap because we would like to show the app next week?

Check ur player setting is also 1280x 800.

That is the problem. There is not a player setting available in the
Android platform that allows you to manually set the resolution,
but there are for the web, mac and pc builds.

I m really sorry, i dint check it before replying. But googled and found a link just check this out.
http://answers.unity3d.com/questions/161281/is-there-a-way-to-android-physical-screen-size.html

Thank you for taking the time and effort to research that with me, but I know the resolution of the
target device. I think that script allows you to build the same application for multiple devices so it will
be handy later. However, I need to get the build working properly on a known resolution which I have
all the assets aligned for. I think the problem is relating to the fact that I can’t set the resolution in the
player settings and turn off full screen by default. The way that I attempted to work around that is to
set the resolution and turn off the full screen when the app loads. Is this somehow not the correct way
of dealing with this?

Try setting your aspect ratio of your camera to a fixed size.

i.e

camera.aspect = 16f / 9f;

Or whatever aspect ratio your target is. Different devices have different aspect ratios and if a set aspect doesn’t look good, you may need to do some tricks to get it looking right on all aspects.

If you’re deploying for a tablet, keep in mind that the task bar will always be in view, no matter what option you’ve selected in Unity. This task bar takes up a segment of the screen that your application expects to use, so in reality 1280x800 becomes something like 1280x780.

Ok, that makes sense.
Maybe the actual display resolution is the next lower common aspect ratio like 1280 x 768?
I will look into the tablets specs and try to find out how much real estate that button bar takes.

I found your other thread, it’s quite confusing to have two threads on the same topic. We miss out on some vital information.

http://forum.unity3d.com/threads/138171-Resolution-problem

Taking a look at those images you posted, it’s not the same issue I had with the task bar, I’m sure of that.

In player settings is the default orientation set to Landscape Left?

And also I noticed in the editor you’re using Free Aspect to design your layout. That is potential disaster. Does it look the same when you select Android Wide (16:10)? Judging by your resolution, this is the aspect ratio you should design at.

One final thing, how is it you’re developing your GUI? Are you using some third party tool like EZGUI, or NGUI?

First of all, thank you for your attention and assistance and for linking others to that thread.

I thought that posting multiple threads might be an issue, but I wanted to get the exposure in the
Android specific forums also. I do have the orientation set to landscape left and the free aspect
window was manually sized to 1280 x 800 which was a workaround to the lack of that resolution
being in the game window drop down.

When I set the game window to that ratio, the assets all appear in the same position (if the game
window is sized at 1280 x 800 or maximized). It is a little confusing the way the game window
resizing affects the placement of assets.

I am developing the GUI using standard GUI controls with a 2 camera system for the backdrop.
The backdrop is on the background camera and the other assets are on the main camera.

Still not resolved, hoping to resolve within the next 6 hours.

I’m sure you already considered this, but please, re-consider:

Nowadays Samsung tablets come with touchscreen mainUI buttons, not real buttons, so this “smart bar” eats 48 pixels of your video resolution hence the real resolution of the tablet is actually 1280x752 which gives a wonderful Aspect Ratio of: 1,70212765957447

Said that, you should consider as a usable viewport only 1280x752, not 800 pixel height, or you will go into this kind of troubles.

Awesome, thanks. I’ll try adjusting everything to that resolution.

Ok, that didn’t work.
I am thinking of going the DisplayMetricsAndroid route and have the user report the resolution back to me.
I was hoping there was an easier way though because I don’t know how to do that yet.

Wait, I might have hit just the same issue than you for the first time.
It appears that Unity 3.5.2f2 has this new bug with initial orientation, which screws up all your Screen.width/height guess.

If on Android I thought this bug was not true, I have just experienced that a build&run on the device (that was probably oriented portrait instead landscape, the fixed orientation for the game) gave this issue, and I had (for the first time since I have done a lot of unity3.5.2f2 builds and never happened before!) the same issue as you, buttons and GUItextures all off the place.

I killed the App, detached the cable and launched again the App.
Everything was fine (it was the same APK BINARY!!!)

So I guess that this bug is true, and very very annoying, but at least, it shows up only sometime when you build&run, but not when you launch the App from the device.

As we are also launching an App this week, we are worried and concerned as well as you for this issue, hopefully, this bug REALLY will show up ONLY when build&run for some reason.

Heh, I’m glad I heard from you on this. At least I am not alone in this issue.
I ended up using the DisplayMetricsAndroid method to grab the display
from the tablet and it did in fact come out as 1280 x 752. For pointing
me in the proper direction, I thank you. Since the game window does
not have a drop down setting for that resolution, I set the window to
free aspect and manually set the window to 1280 x 752 and aligned
all the assets to it. I have my doubts, but we will be testing the app
sometime tomorrow on the tablet (which is at a remote location). I
have experienced odd placement of assets as well during builds
on the PC here and I also suspect that there is an intermittent
bug causing it since simply rebooting does fix it normally. Since
we are in the same boat on this issue, I will keep this thread
open and posted of progress and hope that others will have
some valuable input to add to it. Thank you again everyone.

Note to Ram Thakkar, thank you for the link to the script that discovers Android metrics.

Even after setting it up like that, assets are are still screwbally.
I hope to find a solution for this before Sunday.

Can you provide me a step by step snapshots of this idea, because i am suffering from this matter .
Mean I want a position and scaling of textures on different mobiles , than say me idea pls.