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;//再设置为允许自动旋转 }
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
