Hi everybody,
I would like to know how to get the world position of a text component if it is possible. The point shown in the image (Ashampoo® Web Upload). The canvas is set to world space.
Thanks a lot!
Jymmy097
Hi everybody,
I would like to know how to get the world position of a text component if it is possible. The point shown in the image (Ashampoo® Web Upload). The canvas is set to world space.
Thanks a lot!
Jymmy097
I think lots of people would say to use the RectTransform.anchoredPosition3D property. However I came to the forum today because I’m trying to get the world position of a UI object that is using the World Space canvas and I’m getting crazy values that I can’t use for world space positioning. Hopefully someone here knows what up.
No time to test but RectTransform is a Transform which means it has TransformPoint method
Try something like:
text.transform.TransformPoint(Vector3.zero);
I found some time to test this.
transform.position and transform.TransformPoint(Vector3.zero) work same and return correct result**.**
GetComponent().anchoredPosition3D returns position relative to anchors (which is local position, not world position and depends on position of anchors).
So just use transform.position.
T
Thanks. I will use it.
LG