How to set unity3d Android Orientation

unity3d android orientation

If you have hard time to change the Android Orientation setting in Unity 3d. It is very easy to change the Android Orientation setting to potrait or landscape. In the player setting, under the Settings for Adnroid, click on Resolutions and Presentation and now you can elect Default Orientation.

You can also use code to change the orientation.

if ((Input.deviceOrientation == DeviceOrientation.LandscapeLeft)  (Screen.orientation != ScreenOrientation.LandscapeLeft))
{    Screen.orientation = ScreenOrientation.LandscapeLeft;}      if ((Input.deviceOrientation == DeviceOrientation.LandscapeRight)  (Screen.orientation != ScreenOrientation.LandscapeRight)){    Screen.orientation = ScreenOrientation.LandscapeRight;}

NewImage



Or you can set the orientation during start



using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
    void Start() {
        Screen.orientation = ScreenOrientation.LandscapeLeft;
    }
}
How to set unity3d Android Orientation How to set unity3d Android Orientation Reviewed by Admin on 5:07 AM Rating: 5

No comments:

Powered by Blogger.