We are using Unity to develop Android application. In the Unity, we can easily export to APK file and test it in the Android devices. However, during the development, we need native Android function in Unity.
- Control the Android rotation problem. we need to force to Android device landscape or vertical mode because VR Rehearsal has 2 different mode such as Android portrait mode and VR landscape mode. In the Unity player setting in Android part, we can control the orientation of Android device.as you can see default setting is Auto Rotation. Based on the Android direction, it automatically change the orientation. However, in our application, sometimes we need to fix the orientation in certain scene. So we manually fix the orientation in script. In the Unity start function, we manually force to set the orientation by using script. like this way.as you can see first we set the orientation as a Portrait mode.and we set the false to other orientation.