Unity 代码实现锁定手机横屏

来源:互联网 发布:单片机信号线太长 编辑:程序博客网 时间:2024/04/29 07:09
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;        }}

原创粉丝点击