Unity Android 动态横竖屏设置 2020-09-23

Android已通过,IOS未测试

      //设置横屏
        public override void SetScreenLandscape()
        {
            Screen.orientation = ScreenOrientation.Landscape;
            Screen.autorotateToPortrait = false;
            Screen.autorotateToPortraitUpsideDown = false;
            Screen.autorotateToLandscapeLeft = true;
            Screen.autorotateToLandscapeRight = true;
        }
      //设置竖屏
        public override void SetScreenPortrait()
        {
            Screen.orientation = ScreenOrientation.Portrait;
            Screen.autorotateToPortrait = true;
            Screen.autorotateToPortraitUpsideDown = true;
            Screen.autorotateToLandscapeLeft = false;
            Screen.autorotateToLandscapeRight = false;
        }

你可能感兴趣的:(Unity Android 动态横竖屏设置 2020-09-23)