Search Unity

Resolved Screen FullScreenWindow API: How do I get the monitor Screen.currentResolution display width height?

Discussion in 'Scripting' started by AlanMattano, Aug 7, 2020.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    How do I get the monitor Screen.currentResolution.width height?

    Looks difficult to get .width height. Do I need to split strip the GetString?

    I need to feed
    Code (CSharp):
    1. Screen.SetResolution(monitorWidth, monitorHeight, FullScreenMode.FullScreenWindow);
    STEPS
    • Screen.fullScreenMode = FullScreenMode.FullScreenWindow;

    Actual: Scales up to full-screen window with no borders but maintaining low previous screen window resolution. No info how to get Screen.currentResolution.
    Expected: that FullScreenMode.FullScreenWindow scales up to full-screen monitor resolution.

    ENVIREMENT
    Windows Standalone

    Side Note: Is simple to get Screen.width (that is the window pixel size) but the actual display monitor resolution is needed instead. Unity API framework for windows looks incomplete? Screen.currentResolution.width / height is missing?

    A task that in 2020 must be simple t is not.

    Because the Unity framework API for Windows is not working as expected: the word Screen by itself is ambiguous.

    I need to change the resolution to the windows full-screen monitor actual resolution and is not simple. Is missing currentResolution.width / height. And It should be currentMonitorResolution and not Screen.currentResolution becuse is confusing with Screen.width (the window).
    I can't get the get Screen.currentResolution of the monitor width height in an easy way.

    It is simple to get the window width height but not the monitor.

    How do I get the Screen.currentResolution monitor width height? (int monitorWidth)

    Then need to feed with this monitor resolution the Screen.SetResolution() and specify FullScreenMode.FullScreenWindow or .MaximizedWindow properly.

    What I need is to pass from a small Window to Fullscreen Window (Borderless).
    I presume is

    Screen.SetResolution(monitorWidth, monitorHeight, FullScreenMode.ExclusiveFullScreen);


    Also, ExclusiveFullScreen retains the Screen.width / height (the window size) instead of the monitor height instead when upscaling. And so I can't use FUllScreen in my game. I need a Full-screen window.
    Do I need to use the System Windows Screen framework?
    How do I get

     
    Last edited: Aug 7, 2020
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    AlanMattano likes this.
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Yes, I was. Thx @Kurt-Dekker !

    I was able to make it using different API section.

    Resolution
    https://docs.unity3d.com/ScriptReference/Resolution.html

    SOLUTION
    MaximizedWindow for Windows
    Code (CSharp):
    1. public void Mode_FullScreen_MaximizedWindow()
    2. {
    3.     Resolution currentMonitorResolution;
    4.  
    5.     currentMonitorResolution= Screen.currentResolution;
    6.  
    7.     int width = currentMonitorResolution.width;
    8.     int height = currentMonitorResolution.height;
    9.  
    10.     Screen.SetResolution(width, height, FullScreenMode.MaximizedWindow);
    11. }
     
    Last edited: Aug 8, 2020
    Kurt-Dekker likes this.