Search Unity

Scaling and UI bug

Discussion in 'General Graphics' started by GainfulSage, Sep 4, 2020.

  1. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    106
    I'm having a strange issue with the scaling of my game. I'm getting black bars, as if the game is trying to run at 16:9, but the UI interactions are scaling as if the game is being run scaled.

    UI resolution and scaling problem.jpg

    The game can be played with game pad or keyboard/mouse. The mouse UI interactions are not working - the highlight and hit box are incorrect. This is true for all UI elements on the screen, but are most notable with the smaller UI elements.

    Everything works perfectly in the Editor in Play mode. The issue only occurs when I do a standalone build in any of the fullscreen modes. Windowed mode works fine. When I switch between fullscreen and windowed mode in game, bug appears in fullscreen and disappears in Windowed.

    Unity 2019.4.9f1. macOS Catalina 10.15.6. Standard shader, Cinemachine.

    Help! :)

    player settings.png
     
  2. GainfulSage

    GainfulSage

    Joined:
    Apr 30, 2015
    Posts:
    106
    Resolved:

    The bug only occurs when the Player is set to default to either Fullscreen Window or Exclusive Fullscreen on macOS.

    Setting to Maximized Window or Windowed works correct.

    Changing the configuration in code does not work - if the Player is set to default to Fullscreen Window or Exclusive Fullscreen, changing to Maximized Window in code does not appear to work.

    Interestingly, switching to Windowed in code does work correctly, but only as long as the game stays in Windowed mode. If the Player is set to default to Fullscreen Window or Exclusive Fullscreen, it does not appear to work.

    The documentation is a bit odd, apparently Maximized Window is only supported on macOS, and then if falls back to Fullscreen Window on other OSes.

    https://docs.unity3d.com/Manual/class-PlayerSettingsStandalone.html#Resolution