Hi all. I start learn Unity from a while and from the beginning I saw something I had never seen before. I talk about position of GameObject (doesn’t matter what object ). So lets add some Image for example on scene. In Ispector → Rect Transfor set Anchor top/left and Pos X - 0 / Pos Y - 0. Then in the script file write this. print(img.transform.position.y.ToString()); the result is 768. WHY why is 768 instead 0.
Second think about coordinate system in Unity. The 0/0 on stage (canvas) is bottom left corner WHY???
Ok let’s say I accept bottom left corner to be 0/0 and I create empty object and I position this object on y - 768 (top left corner of my project) and add child in to this empty object for example image. Now no one have no idea what is position of this image.
Anyway please if someone know some setting in unity or some external library to help me with this mish mash coordinate system please tell me.
Because you are seeing a RectTransform in the Editor, which displays the anchoredPosition to you, not the world position of the object. Since Canvases can scale in many ways within the 3D scene they are in, and since UI elements are doing special work for proper layouting, the object’s position in space is not what you work with for UI elements.
Also, the anchored position of an object is in relation to its anchor, as the name suggests. An object that is aligned to the left with anchored position 0,0 will be on the left, a right-aligned UI object with anchored position 0,0 will be on the right. The position of the object is different, but the anchoredPosition is still 0,0.
So when you set the anchored position in the editor, you are not setting the actual position of the object in the scene.
With other words the object can be at 0/0 or 1000/400 or 500/300 in fact doesn’t matter what Transform field show and doesn’t matter what Debug in your code. Everything will happened if you have luck. Other programs like 3ds Max, Maya, Blender, CInema 4d and many more also simulate 3d environment and they also have transform panel but when the object is on position 0/0 this mean object is on position 0/0.
Anyway. Thank you for your response