Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Main

Gets the main window of the application.
Read time 1 minuteLast updated 10 days ago

Definition

public static GameWindow Main { get; }

Remarks

Returns the main window without allocating memory on repeated calls. This property is not thread-safe; use only from the main thread.

Examples

using UnityEngine;using UnityEngine.Windowing;public class MainWindowExample : MonoBehaviour{ void Start() { GameWindow mainWindow = GameWindow.Main; Debug.Log(mainWindow != null ? "Main window acquired." : "No main window."); }}