Search Unity

RectTransform localPosition vs anchorPosition

Discussion in 'UGUI & TextMesh Pro' started by festival, Mar 2, 2018.

  1. festival

    festival

    Joined:
    Feb 3, 2011
    Posts:
    80
    Found out that RectTransform.localPosition doesn’t work anymore in 2017.3.1p2
    if you need to position something in the UI

    RectTransform.anchoredPosition works to position something in the UI

    I like to know why suddenly localPosition didn't work anymore?
     
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Can someone verify if this is true? I thought this still works.
     
  3. OlaBrahammar

    OlaBrahammar

    Joined:
    Jan 9, 2017
    Posts:
    10
    Bumping this as i have the same issue - reading a RectTransform's localPosition in script does not give the same position as i can read at the very same moment in the inspector, this being with achors set to to left corner

    Edit: As festival says, using RectTransform.anchoredPosition works fine, and it works just the way one would expect .localPosition to work.
     
    Last edited: Sep 15, 2018