- Home /
Unity Pro Android orientation on splash image
I am looking to set the orientation of the splash image to only work in landscape mode on android while still keeping left and right orientations. It seems that when I set it to "landscape left" in the publish settings it works as expected but then the app does not rotate to both orientations. If I allow auto rotation and check "Landscape Left" and "Landscape Right" in the allowed orientations the splash image also shows up as portrait which I do not want. Does anyone know of a way to limit this?
Answer by Meltdown · Mar 14, 2012 at 08:24 PM
Try something like this.. although you'll need to play around with the settings to get the desired effect...
void Update()
{
// Only update if orientation switched
if( Screen.orientation != ( ScreenOrientation )Input.deviceOrientation )
{
if( isLandscape )
{
if( Input.deviceOrientation == DeviceOrientation.LandscapeLeft || Input.deviceOrientation == DeviceOrientation.LandscapeRight )
Screen.orientation = ( ScreenOrientation )Input.deviceOrientation;;
}
else
{
if( Input.deviceOrientation == DeviceOrientation.Portrait || Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown )
Screen.orientation = ( ScreenOrientation )Input.deviceOrientation;
}
}
}
Thank you I will try this. Where does this go though? In the first scene to load?
$$anonymous$$eep it to landscape left as you originally did, then put this in your Game$$anonymous$$anager.
Your answer
Follow this Question
Related Questions
96x96 pixel android launcher icon? 1 Answer
Unable to locate player settings. bin/Data/settings.xml 3 Answers
Is there any method called when splash ended on android? 0 Answers
Android screen orientation: why am I getting wrong screen size values? 1 Answer
Bumpy shadow edges in both the Unity editor, and on Android 0 Answers