Screen.orientation = ScreenOrientation.AutoRotation;//设置方向为自动(根据需要自动旋转屏幕朝向任何启用的方向。)
Screen.autorotateToLandscapeRight = true; //允许自动旋转到右横屏
Screen.autorotateToLandscapeLeft = true; //允许自动旋转到左横屏
Screen.autorotateToPortrait = false; //不允许自动旋转到纵向
Screen.autorotateToPortraitUpsideDown = false; //不允许自动旋转到纵向上下
Screen.sleepTimeout = SleepTimeout.NeverSleep; //睡眠时间为从不睡眠
然后在打包中打开
这个改成Landscape Left:左横向屏,就可以在安卓端中打开就直接是横屏
Portrait:竖屏
Portrait Upside Down:翻转竖屏
Landscape Right:右横向屏
Landscape Left:左横向屏
Auto Rotation:自动旋转