Hi all,
I’m migrating iOS game to Android. Recently I have 2 problems.
- Player settings: Default orientation: Auto Rotation. Landscape right and left are checked.
PROBLEM: Game starts portrait orientation and after splash image I can rotate my phone to get landscape mode. After that the game accepts only right and left landscapes as expected. I have a script that places the buttons according to screen width and height but it goes crazy because expected screen width gets height of the screen.
- Splash image doesn’t show full screen.
Any help appreciated.
The splash screen being full screen is dependent on the aspect ratio of the device and the setting you have in the Player Settings. If you choose Center for the Splash scaling, and the splash image doesn’t match your device’s aspect ratio, then you will get letterbox sides potentially. If you have it set to Scale to Fill, it should always be full screen. Also, 1024x768 isn’t a native android resolution for every device, so it will only fit on some devices, but that’s why Unity provides the Scale options in player settings for the splash image. Android does not have any concept of a splash image, whereas iOS builds that into the XCode project. It does some extra manipulation/scaling to make it fit on a very small number of devices but also allows you to select multiple image sizes for your splash, one for each device resolution. Unity creates its own version of the splash screen for Android by presenting it in the main View on startup.
When are you retrieving the Screen.width and Screen.height values? If in the Start method, then they will be wrong once your device rotates after this and you need to retrieve them again. I would like to help with your question, but I’m a bit confused since you say Landscape left or right only works as expected. You want them to not work as expected? What exactly is the issue, you can’t return to portrait mode?