Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Limiting application window size

Discussion in 'Windows' started by dev_gonz, Dec 4, 2019.

  1. dev_gonz

    dev_gonz

    Joined:
    Oct 16, 2019
    Posts:
    10
    Hey everyone,

    I was hoping to grab some help with my problem. I want to limit my application window so it doesn't go under a certain resolution (example no smaller than 400x200).

    I currently have logic that checks the current window size, and if its outside of a certain ratio, resize to target ratio. I can redo this logic but the problem with it is the window flickers between resolutions and its a little gross.

    I want to mimic something similar to Unity editor. There is a limit to when you try and resize the window so it doesn't go below a certain resolution.

    Has anyone done something like this before and able to point me in the right direction? Sample code would also be welcomed.

    Thanks!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,165
  3. dev_gonz

    dev_gonz

    Joined:
    Oct 16, 2019
    Posts:
    10
    Yes correct, we are doing windows standalone.

    Ok we will have a look into it thanks! Is there a reason why the field is not exposed through Unity's API?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,165
    Not really, it's just not something we thought that games would need. Also, it doesn't really map well to different platforms.
     
  5. dev_gonz

    dev_gonz

    Joined:
    Oct 16, 2019
    Posts:
    10
    Thanks for that :)
     
  6. yuli_volta

    yuli_volta

    Joined:
    Mar 22, 2021
    Posts:
    15
    Hi all, just for a 2022 update on this issue (and filling in some gaps from the thread below):
    • Is it possible to set the minimum size for a non-UWP app? I.e. just a standard Windows .exe using Mono?
    • I assume the best way to do this on Mac would be to generate an. Xcode project and add the native API calls there. Is that correct?