- Home /
Screen orientation question...
Is there a way to detect "if it's tablet only allow landscape" "if it's a phone only allow portrait"?
How about googling it?
Detecting Android Tablets and Phones in Unity3D
iOS devices have separated stores for phones and tablets.
Super$$anonymous$$asterBlasterLaser, the problem is that resolution has nothing to do with the screen size, and some phones have greater resolution than some tablets.
Answer by sudhir_kotila · Feb 12, 2015 at 08:20 AM
You can check your device screen resolution :
if (Screen.width == 1024 || Screen.width == 2048) {
//Do your stuff for //iPAD 1024*768 OR 2048*1536
} else if (Screen.width == 960) {
//Do your stuff for //iPOD & iPHONE 960*640
} else if (Screen.width == 1136) { //iPOD & iPHONE 1136*940
//Do your stuff for //iPOD & iPHONE 1136*940
}
You can check your device orientation :
if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft) {
//Do your stuff here...
}
And again: he asks about checking if it is a phone or a tablet and then if it is a phone - only allow portrait, if it is a tablet - only allow lanscape.
I was hoping for a way that detects auto-rotation to i already know if this way but i marked you as answer i've been looking into this at other sites and the auto-rotation part seems to be a big problem with unity