Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ResolutionChangedEventArgs

Arguments for resolution changed event of a GameWindow.
Read time 1 minuteLast updated 6 days ago

Definition

public struct ResolutionChangedEventArgs

Examples

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; } }}

Properties

Property

Description

fullScreenModeThe fullscreen mode of the window after the resolution change.
heightThe new height of the window.
refreshRateThe new refresh rate of the window.
widthThe new width of the window.