Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetIsVisible(bool)

Sets whether the window is visible.
Read time 1 minuteLast updated 10 days ago

Definition

public AsyncOperation SetIsVisible(bool isVisible)

Parameters

isVisible

True to show the window, false to hide it.

Returns

Type

Description

AsyncOperationAn AsyncOperation that represents the asynchronous operation.

Remarks

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.

Examples

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()}"); }; }}