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

2020-09-23  本文已影响0人  保罗柴夫斯基

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;
        }
上一篇下一篇

猜你喜欢

热点阅读