1.在Player Setting里面设置默认的启动屏幕正方向:
2.在控制类的Awake或者Start方法里面,再设置想要的旋转方向
1 2 3 4 5 6 7 8 9 | void Awake() { //设置屏幕自动旋转, 并设置支持的方向 Screen.orientation = ScreenOrientation.AutoRotation; Screen.autorotateToLandscapeLeft = true; Screen.autorotateToLandscapeRight = true; Screen.autorotateToPortrait = false; Screen.autorotateToPortraitUpsideDown = false; } |