Quantcast
Channel: CSDN博客移动开发推荐文章
Viewing all articles
Browse latest Browse all 5930

Unity 代码实现锁定手机横屏

$
0
0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
   


public class groy : MonoBehaviour {	
	void Awake()
        {
                //设置屏幕正方向在Home键右边
                Screen.orientation = ScreenOrientation.LandscapeRight;
        }

        void Start () 
        {
                //设置屏幕自动旋转, 并置支持的方向
                Screen.orientation = ScreenOrientation.AutoRotation;
                Screen.autorotateToLandscapeLeft = true;
                Screen.autorotateToLandscapeRight = true;
                Screen.autorotateToPortrait = false;
                Screen.autorotateToPortraitUpsideDown = false;
        }
}

作者:Czhenya 发表于2017/8/18 10:09:10 原文链接
阅读:22 评论:0 查看评论

Viewing all articles
Browse latest Browse all 5930

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>