Search Unity

Question Screen size affects Rect functionality

Discussion in 'UGUI & TextMesh Pro' started by Josiah_Ironclad, Oct 20, 2020.

  1. Josiah_Ironclad

    Josiah_Ironclad

    Joined:
    Sep 24, 2019
    Posts:
    156
    I'm working on a tetris inventory, and I'm mainly using Rects and things like Rect.Overlaps().

    I've currently got this weird issue where my code breaks Depending on the game view window size.
    - Maximised window
    - Small window

    When the window is maximised everything works fine. But at some smaller sizes the issue either presents itself either horizontally, vertically, or in both directions. Have a look at both videos because I'm bad at explaining things sometimes. Hopefully you'll see the issue.

    Here's an attempt at an explanation:
    When items are side-by-side, they shouldn't overlap (background should be blue, not red). Same if they are one above the other. However on small window sizes, sometimes the items register as overlapping, even though they aren't.

    P.S. Don't worry about the red and green squares, they aren't relevant.