App starts and then runs in landscape mode (Unity 4.2 - Android)

Has anyone else experienced the possibility to start the app in landscape mode even though the Player Settings are as follows:

  • Default Orientation: AutoRotation,
  • both Portrait options checked and the landscape ones are unchecked?

After it starts in landscape mode it also runs in landscape mode and once you try to rotate to portrait mode the app crashes.

I can only trigger this behavior on Android after updating to Unity 4.2.
If so, does anyone have a solution?

Update: Solution - Add android:screenOrientation=“sensorPortrait” to the main activity in the Manifest. Looks like Unity does not add that after exporting the Android Project.

Thanks, just what I needed

1 Answer

1

I do had to deal with this::

Solved it by setting the manifest.xml
In the Android Manifest write this:

android:configChanges="orientation"
android:screenOrientation="sensorLandscape"

like in the example below.

<activity android:name=".MainActivity"    
              android:label="@string/app_name"
              android:configChanges="orientation"
              android:screenOrientation="sensorLandscape">
 </activity>

Don’t forget to mark it answer and give thumbs up @AlexGav