Hi,
I’m trying to get the relative position of a RectTransform to Canvas, but it always gives zeros values. I’m using Vertical’s Layout in the parents.
How can I get the values that can see in the RectTranform of the gameobjects.png capture?
Thanks and grettings!!
hello thats because the verticallayoutgroup doesnt update till end of frame you can use the start event as a corroutine and break till end of the frame
IEnumerator Start () {
yield return new WaitForEndOfFrame();
Debug.Log(GetComponent<RectTransform>().anchoredPosition);
}