I have an element with the following style settings (screenshot below). It is clearly not in the 0 Length by x.
However, if I call _visualElement.style.translate.value.x.value at runtime, it will return 0. The element itself is shown correctly, in the middle of the screen.
And if I set x value manually using something like:
Length x = _visualElement.style.translate.value.x;
Length y = _visualElement.style.translate.value.y;
_visualElement.style.translate = new StyleTranslate(new Translate(x, y));
this will move the element to the left border of the screen (where the 0 is)
So, in a word, it returns the wrong value, but if you don’t touch it, the element is displayed correctly (in the middle of the screen).
If you touch it, it will be redrawn at the 0 by x.
The question is, is that a bug, or am I missing something?
The same thing happens for elements moved with a Position style using UIBuilder or for Relative (not Absolute) elements.
Unity version 2021.3.24f1