Inconsistent Position Values When Centering a GuiObject with AnchorPoint (0.5, 0.5)

Issue Description

When setting a GuiObject’s AnchorPoint from {0, 0} to {0.5, 0.5} and centering it in the screen by dragging (without manually entering {0.5, 0}, {0.5, 0} into the Position property), the Position value is sometimes recorded as {0.5, 0}, {0.5, 0} but other times as {0.5, 0}, {0.499, 0}, missing one pixel.

Although this may seem like a minor issue, it creates inconsistencies when positioning UI elements, as the expected behavior should strictly set {0.5, 0}, {0.5, 0} when perfectly centered.

Reproduction Steps

  1. Insert a Frame, ImageLabel, or any other GuiObject inside StarterGui.
  2. Change the AnchorPoint to {0.5, 0.5}.
  3. Drag the UI element to center it within the screen.
  4. Observe the Position value in the Properties window.
  5. Repeat the process multiple times.

Expected Behavior

The Position value should always be {0.5, 0}, {0.5, 0} when the UI element is centered on the screen, ensuring precise alignment. However, the issue causes the Position value to sometimes be {0.5, 0}, {0.499, 0}, introducing a one-pixel discrepancy that affects consistency. This inconsistency can be problematic when exact centering is required for UI design, as it leads to unintended misalignment.

Visual Aids:

As you mentioned, it’s a minor issue but it’s really annoying. I always set the position manually to 0.5 to avoid this, but it’d be nice if they fix it.

Hi, we looked into this issue. Due to the fact that we support the fractional number dpi-scaled viewport sizes as well as fractional scaling based absolute sizes, we cannot guarantee that calculating centering could be very precise for every case. :crying_cat: If you really care about perfect alignment, please manually type in (0.5, 0.5) under this condition. Note that even you manually type in a number of (0.5, 0.5) as positioning, the pixel rounding could still position item in a place that is misaligned with another item with position 0.5, 0.5 according to the dpi scaling of screen and your gui item’s absolute size.

1 Like