Version: Unity 6.4 (6000.4)
LanguageEnglish
  • C#

ResolutionChangedEventArgs

struct in UnityEngine.Windowing

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Arguments for resolution changed event of a GameWindow.

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.