kingBook

导航

unity 设置屏幕旋转

只允许竖屏:

Portrait                    √

Portrait Upside Down √

Landscape Right        ×

Landscape Left          ×

只允许横屏:

Portrait                    ×

Portrait Upside Down ×

Landscape Right        √

Landscape Left          √

代码动态设置屏幕旋转:

private void setLandscape(){
    Screen.orientation=ScreenOrientation.Landscape;//如果屏幕是竖屏,则立刻旋转至横屏

    //设置只允许横屏旋转
    Screen.autorotateToPortrait           =false;
    Screen.autorotateToPortraitUpsideDown =false;
    Screen.autorotateToLandscapeRight     =true;
    Screen.autorotateToLandscapeLeft      =true;

    Screen.orientation=ScreenOrientation.AutoRotation;//再设置为允许自动旋转
}

 

posted on 2017-03-02 12:53  kingBook  阅读(2954)  评论(1编辑  收藏  举报