CreateWindowAsyncOperation
Asynchronous operation object returned from GameWindowManager.Create. This class extends AsyncOperation. You can yield until it continues, register an event handler with CreateWindowAsyncOperation.completed, or manually check whether it's done ( CreateWindowAsyncOperation.isDone ) or progress ( CreateWindowAsyncOperation.progress ).
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Class
- Namespace: UnityEngine.Windowing
- Assembly: UnityEngine.WindowingGatedModule
- Inherits from: AsyncOperation
public sealed class CreateWindowAsyncOperation : AsyncOperation
Remarks
The CreateWindowAsyncOperation class encapsulates the asynchronous window creation process. Once the operation is complete (isDone is true), you can access the created window through the window property.
Additional Resources: AsyncOperation, GameWindowManager.Create.
Examples
using System.Collections.Generic;using UnityEngine;using UnityEngine.Windowing;public class CreateWindowExample : MonoBehaviour{ List<DisplayInfo> displayInfos = new List<DisplayInfo>(); void Start() { DisplayInfo.GetLayout(displayInfos); var settings = new GameWindowCreationSettings( title: "Second Window", width: 600, height: 400, position: new Vector2Int(0, 0), cameraDisplayIndex: 1, displayInfo: displayInfos[0], fullScreenMode: FullScreenMode.Windowed, resizable: false ); var op = GameWindowManager.Create(settings); op.completed += (AsyncOperation o) => { Debug.Log($"Window Created: {op.window.GetTitle()}"); }; }}
Properties
Property | Description |
|---|---|
| window | Returns the created GameWindow after the asynchronous operation completes. |