Can you tell unity to resize the Game window by a button press?

Hello, the reason I’m asking this is because I’m making a game where to user can resize the window by powers of what the screen was already at. an sample of would be in NES emulators you can resize the emulator to. well it starts at 256x240 and you can resize it to 256 + 256 so its like 512x240 and then resize it again, thats what I’m trying to get. any one know of a way to possibly do this?

using UnityEngine;
using System.Collections;

public class ResizeTest : MonoBehaviour
{
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 256, 32), "Resize Up"))
        {
           
        }
    }
}

That don’t work either :confused:

You can use Screen.SetResolution().

if (GUI.Button(new Rect(10, 10, 256, 32), "Resize Up")) {
Screen.SetResolution(Screen.width + 256, Screen.height + 256);

}

You can set the window size programmatically using Screen.SetResolution. Perhaps that’s what you’re looking for?