Unity打包exe设置全屏和窗口模式切换

using UnityEngine;
/// <summary>
/// 切换全屏和窗口模式
/// </summary>
public class Fullscreen : MonoBehaviour
{
    //切换
    private bool switchover;

    private void Awake()
    {
        switchover = false;       
        Screen.SetResolution(1920, 1080, switchover);        
    }

    // Update is called once per frame
    void Update()
    {
        //  按Control切换全屏或者窗口模式      
        if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
        {
            switchover = !switchover;
            Screen.SetResolution(1920, 1080, switchover);
            Screen.fullScreen = switchover;  
        }

    }
}
 

    原文作者:weixin_42510277
    原文地址: https://blog.csdn.net/weixin_42510277/article/details/105262047
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞