Arguments for resolution changed event of a window.
using UnityEngine; using UnityEngine.Windowing;
public class WindowingTest : MonoBehaviour { GameWindow mainWindow;
private void Awake() { mainWindow = GameWindow.Main; }
private void OnEnable() { // Register the callback mainWindow.RegisterResolutionChangedCallback(WindowResizeCallback); }
private void OnDisable() { // Unregister the callback mainWindow.UnregisterResolutionChangedCallback(WindowResizeCallback); }
private void WindowResizeCallback(GameWindow window, ResolutionChangedEventArgs args) { Debug.Log($"Main window resized to: {args.Width}x{args.Height} : {args.RefreshRate.value}Hz"); switch (args.FullScreenMode) { case FullScreenMode.FullScreenWindow: Debug.Log("Main window is fullscreen."); break; case FullScreenMode.Windowed: Debug.Log("Main window is windowed."); break; } } }
| Property | Description |
|---|---|
| FullScreenMode | The fullscreen mode of the window after the resolution change. |
| Height | The new height of the window. |
| RefreshRate | The new refresh rate of the window. |
| Width | The new width of the window. |