Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to calculate RectTransform Top and Bottom values after anchor changes

Discussion in 'UGUI & TextMesh Pro' started by gokhancnr, May 21, 2023.

  1. gokhancnr

    gokhancnr

    Joined:
    Jul 25, 2020
    Posts:
    20
    Hi all,

    I have a RectTransform fully stretched.

    If I change the anchorMin.y and anchorMax.y values from editor; Top and Bottom values having a calculation and is being changed immediately.

    My question is how can I get this formula and reach out these values?

    I meant to say how can I make sure that if I change the anchorMin.y to 0 and anchorMax.y to1 then Top and Bottom values will be xx?

    Below you can see if I change these values Top and Bottom values will be like this:



    Thanks in advance.
     

    Attached Files:

  2. gokhancnr

    gokhancnr

    Joined:
    Jul 25, 2020
    Posts:
    20
    My Canvas also like this:

    upload_2023-5-22_10-53-17.png