IgnoreGuiInset, CoreUISafeInsets does not get ignored in AbsolutePosition

Heya, while using “IgnoreGuiInset” I ran into unexpected behaviour with Frame’s AbsolutePosition that I could not find documented anywhere (and well, it does not make sense).

When using IgnoreGuiInset, child Elements of the ScreenGui have the GuiInset added to their y-axis in AbsolutePosition (But that is the case only when using IgnoreGuiInset = true)
This problem creates inconsistencies between ScreenGui States and makes this difficult to work with especially when you are not made aware of it.

note: ScreenInsets does not change the behaviour whatsoever

(0, 0) with GuiInset enabled
image

(0, 0) with GuiInset disabled
image

This “bug” makes it so you have to use the GuiInset when dealing with AbsolutePositions and IgnoreGuiInset set to true

Expected behavior

AbsolutePosition should remain unaffected regardless of the GuiInset setting

2 Likes

Hi @MagikTheWizard, thanks for the feedback on this!

I agree, the behavior of GuiBase2d.AbsolutePosition can be sometimes be confusing with regards to ScreenGui.IgnoreGuiInset! I think the confusion can be caused by the fact that in Studio Edit mode, the Core UI safe insets are zero, so the AbsolutePosition coordinate system is equivalent to the fullscreen coordinate system.

However, in Studio Play mode, the Core UI safe insets are non-zero, so there is a difference between these coordinate systems.

Hopefully this diagram from the GuiBase2d.AbsolutePosition documentation can help to clear up some of the confusion. The diagram shows the coordinate system used by the AbsolutePosition property:

The AbsolutePosition property uses the CoreUISafeInsets coordinate system, whose origin is at the bottom left of the top bar area. This shouldn’t change, regardless of the values of ScreenGui.IgnoreGuiInset or ScreenGui.ScreenInsets.

However, note that the GuiObject.Position property specifies offset from the parent GuiBase2d’s anchor point plus parent’s insets/padding. So, if we parent a GuiObject to a ScreenGui, the GuiObject.Position specifies offset from the parent ScreenGui’s ScreenInsets.

Based on the above diagram, if we ignore the Core UI safe insets (by enabling ScreenGui.IgnoreGuiInset=true and ScreenGui.ScreenInsets=Enum.ScreenInsets.DeviceSafeInsets) the Y AbsolutePosition of a GuiObject with Position={0,0,0,0} can be negative. This is because we specify 0 Position offset between the GuiObject and the DeviceSafeInsets viewport, which is above the CoreUISafeInsets viewport, and +Y is in the down direction (y axis is flipped).

In contrast, if IgnoreGuiInset=false (and ScreenInsets=Enum.CoreUISafeInsets), the Y AbsolutePosition of a GuiObject with Position={0,0,0,0} should be 0px, since the Position property specifies 0 offset from the CoreUISafeInsets origin.

Here is a comparison of how the ScreenGui.IgnoreGuiInset property affects a GuiObject with Position={0,0,0,0}:

For more information, here are some doc pages which cover screen insets:
On-Screen UI Containers tutorial
ScreenGui.ScreenInsets property
Enum.ScreenInsets enum
Notched screen support release post

I hope the info above helps to explain why the AbsolutePosition depends on the IgnoreGuiInset property. Please let us know if this made sense, or you have any ideas for how to improve the documentation and tutorials on this topic!

I think some of the confusion could be resolved by displaying the Core UI top bar in Studio Edit mode, so there are non-zero Core UI safe insets at edit time. Do you think this change would improve your UI authoring workflow?

Thanks again for your feedback!

1 Like