Search Unity

UWP -> Unable to re-enter full screen mode after exiting

Discussion in 'Windows' started by PeachyPixels, May 5, 2020.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hello!

    My UWP game is running full screen, set in the build settings. On exiting full screen (via the title bar button with two inward facing arrows) it appears to go into maximised mode, without a way of re-entering full screen mode. This means the title bar will then always be visible as will the taskbar (depending on your Windows settings)

    I believe Windows used to support a button to re-enter full screen mode on UWP apps, but maybe this was removed a while back?

    Is there a way for Unity to (auto) handle entering full screen mode again by any chance please?

    Failing that, I'm guessing it's possible to use...

    Code (CSharp):
    1. UnityEngine.WSA.Application.windowSizeChanged
    Then...

    Code (CSharp):
    1. Screen.SetResolution(width, height, true)
    ?

    Any help would be much appreciated.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    This was available on Windows 8.1 apps. It wasn't done by Unity - the button was part of OS title bar. Microsoft removed it for UWP.

    You mean force full screen mode? Unfortunately that isn't possible as Windowing APIs will actually fail if you try to undo what the user just did.

    May I suggest implementing a keyboard shortcut (ALT + Enter) to reenter fullscreen, and an optional settings menu?
     
  3. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hi Tautvydas, thanks for the reply.

    Not force per se, but an auto restore full screen (developer) option. So if the app was full screen and the user drops out to windowed mode, maximising would then go full screen again (instead of a maximised window). That way no need to clutter the ui with a full screen button. Hope that makes sense?

    Would it also be possible to add a windowSizeChanging event to UnityEngine.WSA.Application please? If the player drops out of full screen mode, it would be very helpful to have certain restrictions on how small\large they can make the window. Events for dropping out of\in to full screen or minimized\maximized mode would be icing on the cake :)

    It would definitely allow the developer more control over the switch between windowed & full screen mode.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    How would you use windowSizeChanging?
     
  5. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    For this project, if the player drops out of full screen mode I would prefer to...

    a) Force the (host) window dimensions to honour a specific aspect ratio
    b) Stop the (host) window from dropping below a certain size

    If windowed \ full screen, minimize & maximize events were surfaced, there wouldn't be a need for the auto restore full screen feature mentioned above either. It would be easy functionality for developers to add if required.

    Ultimately, if we had a little more visibility as to what the host window is doing (and allowing size changes to be overridden) it would make for a much slicker experience on Windows.
     
    Last edited: May 6, 2020
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680