只允许竖屏:

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;//再设置为允许自动旋转
}

 

相关文章:

  • 2021-12-03
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2021-06-19
猜你喜欢
  • 2021-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
相关资源
相似解决方案