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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Wrong hit test on full screen non-native resolution in Unity 5.1.2 Direct3D11

Discussion in 'UGUI & TextMesh Pro' started by movra, Jul 17, 2015.

  1. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Can anyone confirm:
    • create new project
    • create new scene
    • add button
    • save scene
    • build to standalone
    • run game in full screen on non-native resolution
    • try to press the button; will fail
    • click around the button, will likely succeed
    • run again at native resolution, pressing button will work as expected
    • hit tests as expected in Unity 4, not in Unity 5.1.2
     
    Last edited: Jul 17, 2015
  2. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    In Unity 4 you'd get black bars if game aspect ratio doesn't match the monitor's aspect ratio.

    In Unity 5 and Direct3D11, when you choose for example 640x480 from the game launcher on a monitor with a different aspect ratio, the screen will be extended to fill the physical monitor and eliminate any black borders. Unfortunately in this case the math is off for the mouse position.
     
  3. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
  4. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
  5. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    this issue is happening on my end too.
     
  6. Ademisk

    Ademisk

    Joined:
    Jul 4, 2015
    Posts:
    2
    Does anyone know of a workaround for this? Been bothering me while learning how to utilize UI.
     
  7. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    In the Editor it works OK. In the build, keep the same aspect ratio as the desktop, preferably the same resolution. Otherwise disable D3D11.