As the snip shows here, the sizes aren’t match. With it, I can’t use the move tool to position them. Is there any solution for this? The only way to position them is changing the values in inspector and it is extremely inconvenient…
Always start with the docs when something doesn’t make sense.
https://docs.unity3d.com/ScriptReference/RectTransform-rect.html
You’ll see it is a local quantity.
Not true at all. You can use any of the layout Components such as GridLayoutGroup.
You could even make invisible anchor RectTransforms in the corners and compute your sizes and positions from those fractionally.
Manipulating UI positions directly is HARD. I never do it. Instead, use layouts or else compute positions based on other objects.
Attached is my dynamic UI example, which uses a layout Component.
Hmm…I still don’t get what is causing this issue…
If your picture is relying on the numbers in the corner, again, those are not what you expect.
To see what I mean, make a blank scene, create a single UI/Image (which will come with canvas).
Now select the image and observe the numbers. Doesn’t matter where it is.
Now while watching the numbers, move the pivot. Huh! Doesn’t move the visual object, and yet numeric positions change all over the place!
Now while watching the numbers, move the anchors… huh! Again, does not move the visual, yet more changes
This is what I mean by it is HARD to manipulate this cruft in code. You really DO NOT want to do this. Use a Layout Component of some type or you are going to be very unhappy.
For instance, just the simple act of placing the anchors at the corners of a RectTransform is a MASSIVE sheet of weird code that has to be executed in precisely the correct order:
If you really enjoy pain, go digging through the UnityEngine.UI source code, which is on your computer as the package. Good luck!