Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Assets Aspect Ratio Controller (enforce window aspect ratio)

Discussion in 'Works In Progress - Archive' started by Denchi_, Dec 18, 2018.

  1. Denchi_

    Denchi_

    Joined:
    Dec 17, 2018
    Posts:
    23
    Hey everyone,

    I wrote a script that enforces an arbitrary aspect ratio for standalone Windows builds (Windows only, 32/64 bit).
    It works by intercepting window resize events (specifically the WinProc callback function) and modifying them to maintain the desired aspect ratio.

    I'm not sure how useful it really is since you could just use letterboxing and stay platform independent, but if you're interested, feel free to take a look:

    https://github.com/DenchiSoft/UnityAspectRatioController

    Any feedback is, of course, most welcome. :)



     
  2. jterry

    jterry

    Joined:
    Oct 30, 2014
    Posts:
    9
    This is awesome! Thanks for sharing!
     
  3. radoslawpolasik

    radoslawpolasik

    Joined:
    Jul 24, 2018
    Posts:
    2
    Just what I was looking for, works sweet, thanks!
     
  4. bhermer

    bhermer

    Joined:
    Jun 24, 2013
    Posts:
    28
    Thanks Denchi worked perfectly, and saved me a ton of time.
     
  5. Rob-Hafey

    Rob-Hafey

    Joined:
    Jul 24, 2014
    Posts:
    12
    Yes, thanks for the code. Worked perfectly for me as well. Anyone know of a solution for the Mac?
     
  6. BarashkaZZ

    BarashkaZZ

    Joined:
    Feb 17, 2019
    Posts:
    1
    Phenomenal work! Works exactly as needed.