只允許豎屏:
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;//再設置為允許自動旋轉 }