Search Unity

Question Get outer dimensions of window in Windowed mode.

Discussion in 'Editor & General Support' started by EricLowry, Jan 5, 2022.

  1. EricLowry

    EricLowry

    Joined:
    Apr 12, 2015
    Posts:
    17
    Hi everyone!

    The game I'm working on defaults to
    FullScreenWindow
    mode (which is borderless), but we have some users who want it to be
    Windowed
    .

    What we'd like to do is have the windowed resolution fill up the screen by default when switching from
    FullScreenWindow
    to
    Windowed
    .

    The issue is that if I set the same game resolution as the screen size upon exiting
    FullScreenWindow
    , the OS borders aren't taken into account, and the game "sticks out" of the screen a bit at the right and quite a lot at the bottom.

    Ideally I'd like to get the "outer" resolution of the actual window in the OS in order to compensate for it if that's possible?

    And I know I could use
    MaximizedWindow
    to get a similar effect, but then the window would still stick out when the user un-maximizes it, and we have it set to not be manually resizeable for other reasons.