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

GameWindow.SetIsVisible

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 SetIsVisible(bool isVisible);

Parameters

Parameter Description
isVisible True to show the window, false to hide it.

Returns

AsyncOperation An AsyncOperation that represents the asynchronous operation.

Description

Sets whether the window is visible.

Hiding a window doesn't destroy it or release its resources. The window keeps its title, position, and resolution, and you can show it again later. Use GameWindow.IsVisible to query the current value.

Note that if you hide every window, the operating system might suspend the application and it stops running its update loop. Scripts can't show a window again while the application is suspended, so keep at least one window visible if you rely on script execution to restore the others.

using UnityEngine;
using UnityEngine.Windowing;

public class SetWindowVisibleExample : MonoBehaviour { void Start() { var window = GameWindow.Main; var op = window.SetIsVisible(false);

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