- Home /
Question by
GoodyTong · Jun 04, 2015 at 01:23 PM ·
uitransformtransform.position
Screen position of the uGUI object that deep in hierarchy
I got a Button that deep in heirarchy. The first panel has Horizontal Layout Group, other three is loyout content. I try to get position of the button in one of layout contents relative to screen position.
I already tried
gameObject.GetComponent<RectTransform>().position
gameObject.GetComponent<RectTransform>().localPosition
gameObject.GetComponent<RectTransform>().anchoredPosition
gameObject.GetComponent<Transform>().position
gameObject.GetComponent<Transform>().localPosition
All just return local position. Can anyone give any advice. Thanks for any help.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613200605im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Finding an objects position from one canvas to the other 1 Answer
transform.position not setting position OR animation setting position even though it shouldn't 0 Answers
[2D] Get the position of an object outside the scope 2 Answers
moving objects with transform position 2 Answers
Update instantiates more than 1 object 2 Answers