Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    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. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    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,130
    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