I have a cross platform game that supports iOS and Android and also supports both portrait and landscape. All of the code for handling rotations works fine, but one problem I am having is that on Android the system rotation lock seems to be ignored by Unity.
On iOS, we have it set that the app can autorotate to any orientation, but when the iOS rotation lock is on, then the game stays in whatever orientation the system is in (which is what I would expect)
On Android we have the exact same settings, only when the rotation lock (at least on my N7 with 4.2.2) I can have the system rotation lock on, and still my game will happily rotate through all of the orientations.
Is there something I can do to detect or respect the system settings somehow? Or do I need to replicate the rotation lock inside my app?
I wish that were the case. I can do a build with my version of 4.2.1 Pro with Android Pro and it will happily ignore my device lock settings. am I doing something stupid? (entirely possible
Ok, then the problem is probably the every rotation possible setting, because the other game I tested had only landscapes enabled (with 4.x) and it was correctly locked, but the other had all rotations enabled (with 3.x) and it rotated also when locked.
Bumping this thread because we’re running into the same issue. It looks like an issue with Unity itself and not with your project. I reported it as a bug and included a sample project. I’ll post here if/when I hear anything back from Unity.
This is a bit awkward but the problem is that Google didn’t provide an API to determine the user locked orientation so there is no good way for us to honor the orientation selected by the user. In Android 4.3 Google added some manifest attributes which can give more fine grained control but that means your app won’t work on any device running Android 4.2 or less. We have some ideas that might work as a compromise but to be honest none of them are very good.