- Home /
iOS and Android Resolution limitation
I'm working on a 2d infinite run game and i'm trying to set the height limitation so that my game character does not leave the screen. but i'd like to target as many resolutions as possible for iOS and Android. so for example I've done something like
if(Screen.width == 960){
Debug.Log("Running iPhone 4 resolution");
else if(Screen.width == 1136){
Debug.Log("Running iPhone 5 resolution");
and in these resolutions i can set maxHeight and minHeight in pixels and not passing that limit. Is there an easier way to go about this so i can target more resolutions without all the specific pixel values?
For android the screen width can be nearly an unlimited amount of options so you will need to do somthing like getting the Screen.width then setting that to the width of where your character can be. For iOS you are heading in the right direction as you can optimise it better using that method,
Check out these links for a bit of other information: - http://answers.unity3d.com/questions/518643/build-2d-game-for-different-resolutions-android-ph.html - http://stackoverflow.com/questions/17862677/how-can-i-code-my-game-to-work-on-every-resolution-of-android-devices-with-uni - http://answers.unity3d.com/questions/398396/how-to-make-gui-adjust-to-different-resolutions-ma.html
well my problem isnt the GUI it's the game character leaving the screen.