unity-flex-ui icon indicating copy to clipboard operation
unity-flex-ui copied to clipboard

Selecting GameObject with FlexLayout sometimes adds 100px to layout properties

Open alexanderlarsen opened this issue 7 months ago • 1 comments
trafficstars

Issue

Occasionally, selecting a GameObject with a FlexLayout component causes 100px to be added to one of the size properties (height, minHeight, maxHeight or width, minWidth, maxWidth), depending on the flex direction.

Details

  • Happens with some GameObjects, not consistently.
  • Whether it happens to width or height seems tied to the flex direction (row vs column).
  • Can occur both in edit mode and at runtime.

Example

Before selecting Time Attack element:

Image

Image

After selecting/clicking on Time Attack element:

Image

Image

alexanderlarsen avatar Apr 21 '25 11:04 alexanderlarsen

Hi @alexanderlarsen, thanks for the report. That's really weird 🤔

Happens with some GameObjects, not consistently.

Maybe there's some other component in them that could be messing with the FlexLayout? The only place in FlexLayout that changes Width / Height "automatically" is Reset, which is a standard Unity message called when the component is first added, or when you click "Reset" in its context menu. Since you also have min/max width/height being affected as well, I guess it's not that.

Can attach a debugger to Unity with a breakpoint in the setter of Width or Height properties and check what's the stacktrace when you select such GameObjects, so we have more information on what's going on?

gilzoide avatar Apr 21 '25 12:04 gilzoide