コード例 #1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F10))
        {
            if (QualitySettings.vSyncCount < 1)
            {
                QualitySettings.vSyncCount = 1;
            }
            else
            {
                QualitySettings.vSyncCount = 0;
            }
        }

        if (Input.GetKeyDown(KeyCode.F11))
        {
            if (!Screen.fullScreen)
            {
                windowedResolution = new Resolution()
                {
                    width = Screen.width, height = Screen.height
                };
                Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
            }
            else
            {
                if (windowedResolution.width == 0 || windowedResolution.height == 0)
                {
                    windowedResolution = new Resolution()
                    {
                        width = Screen.currentResolution.width / 2, height = Screen.currentResolution.height / 2
                    }
                }
                ;

                Screen.SetResolution(windowedResolution.width, windowedResolution.height, false);
            }
        }

        if (pauseAction.GetDown() && !isPaused)
        {
            pauseMenu.Open();
        }
    }