Been doing a lot of searching for this and yet to fix my issue. Basically when the phone is in immersive mode (which works fine) then I can't find a way of getting the true resolution and at a complete loss.
As an example I have an Xperia E1 that should be 480, 800 however all methods I know of reading the screen sizes return 480, 744 which is a huge problem for our game.
What I have tried:
Screen.currentResolution
Screen.width and height
Screen.resolutions (returns nothing as expected)
and even the fancier:
using(
AndroidJavaObject metricsInstance = new AndroidJavaObject("android.util.DisplayMetrics"),
activityInstance = unityPlayerClass.GetStatic("currentActivity"),
windowManagerInstance = activityInstance.Call("getWindowManager"),
displayInstance = windowManagerInstance.Call("getDefaultDisplay")
)
{
displayInstance.Call("getMetrics", metricsInstance);
debugLabel.text += "Test: " + metricsInstance.Get("heightPixels") + ", ";
debugLabel.text += metricsInstance.Get("widthPixels");
}
But sadly all the methods return the 'wrong' resolution, 744 in this case. I have tried this on other 4.4 devices (at least 3) and they all have the same issue. If I manually set the resolution, in this case with height back to 800, everything works as I would like so I am extremely confused!
Anyone any ideas or suggestions? Suprised no one seems to be talking about this!
↧