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. Dismiss Notice

Question Force a 4:3 Aspect Ratio

Discussion in 'Editor & General Support' started by Alvarden, May 24, 2023.

  1. Alvarden

    Alvarden

    Joined:
    Feb 22, 2019
    Posts:
    55
    Hello everyone. Just a quick question: how do i force a 4:3 aspect ratio, regardless of the resolution? And yes, i do have only checked the 4:3 option for the Supported Aspect Ratios and the rest is unchecked, but when built, the game launches with a 16:9 aspect ratio (in my case).
    And since we are on the topic: how do i force a 4:3 aspect ratio on a WebGL build?

    ts890ndW1d.png

    Thank you for your time.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,561
    Should be easy on WebGL, just set 1024x768 and be done.

    AFAIK, for other targets it will be harder, especially when you go fullscreen.

    The UI can be easily handled with an AspectRatioFitter component.

    But the camera will need its rect adjusted so the visible part is 4:3, plus on wider screens you'd need side black bands, or if the screen was taller than 4:3, top and bottom black bands to fill in the gaps.

    Black bands could be UI or just Cameras set to clear to black, but there would be some computation fiddling to get the right ratios.

    That's how I've always done it. Perhaps someone else has made a more turnkey example.
     
  3. Alvarden

    Alvarden

    Joined:
    Feb 22, 2019
    Posts:
    55
    Mmmm, ok, thanks for the info.