Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

GameWindow.SetIsResizable

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public AsyncOperation SetIsResizable(bool isResizable);

Parameters

Parameter Description
isResizable True to allow the window to be resized manually, false to prevent it.

Returns

AsyncOperation An AsyncOperation that represents the asynchronous operation.

Description

Sets whether the window can be resized manually.

This only controls manual resizing through the windowing system. You can always resize the window from a script with GameWindow.SetResolution. Use GameWindow.IsResizable to query the current value.

This method has no effect on QNX, where the platform doesn't support changing whether a window is resizable, or on a full-screen window on any platform. In both cases the returned operation still completes successfully, but the value that GameWindow.IsResizable reports doesn't change.

using UnityEngine;
using UnityEngine.Windowing;

public class SetWindowResizableExample : MonoBehaviour { void Start() { var window = GameWindow.Main; var op = window.SetIsResizable(true);

op.completed += (AsyncOperation o) => { // Triggers when the resizability change is complete Debug.Log($"Window resizability set to: {window.IsResizable()}"); }; } }