美文网首页
Unity Android 动态横竖屏设置 2020-09-23

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

作者: 保罗柴夫斯基 | 来源:发表于2020-09-23 20:15 被阅读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;
        }

相关文章

网友评论

      本文标题:Unity Android 动态横竖屏设置 2020-09-23

      本文链接:https://www.haomeiwen.com/subject/amaoyktx.html