Search Unity

Question Problem about anchored position calculation.

Discussion in 'UGUI & TextMesh Pro' started by GuoQPro, Jun 17, 2020.

  1. GuoQPro

    GuoQPro

    Joined:
    Sep 9, 2019
    Posts:
    3
    Here is the thing: Artboard.png


    In the situation that the anchors are separated with value (0, 0) (0.5, 0.5), the anchored position of the red rectangle should be the vector(the yellow arrow) from the center of the anchor rect, which is (-125, -125), to the pivot position(100, -50), the result should be (225, 75), and so it is.

    But if I move the pivot to the bottom (100, -100), I think the anchored position should be (225, 25), but in fact, it is (225, 150)(the green arrow). Do I misunderstand anything or is there anything else that should be considered when the pivot is not at the center?
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Are you sure that you moved the pivot to the bottom and not to the top? Keep in mind that the coordinate system of the UI has its origin in the lower left corner.
    A pivot on the bottom would have the y-value of 0.
     
  3. GuoQPro

    GuoQPro

    Joined:
    Sep 9, 2019
    Posts:
    3
    Screen Shot 2020-06-17 at 10.35.18 PM.png

    The problem is that I don't think the y value should be 150 neither the pivot is moved to the bottom nor to the top.