Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

RectTransform localPosition vs anchorPosition

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

  1. festival

    festival

    Joined:
    Feb 3, 2011
    Posts:
    72
    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,144
    Can someone verify if this is true? I thought this still works.
     
  3. OlaBrahammar

    OlaBrahammar

    Joined:
    Jan 9, 2017
    Posts:
    6
    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