文档

Unity Engine


User Manual

Script Reference

Unity Engine


Main

Gets the main window of the application.
阅读时间1 分钟最后更新于 1 个月前

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