Search Unity

[Question] New UI Anchor snap to button/element

Discussion in 'UGUI & TextMesh Pro' started by PedroGabriel00, Sep 1, 2014.

  1. PedroGabriel00

    PedroGabriel00

    Joined:
    Sep 1, 2014
    Posts:
    1
    Hello guys,
    I've been trying to accomplish this for a while but had no clue if this is supported or I'm just doing it wrong...

    I was trying the new UI at Android but found the best way to make it stretch correctly was setting the anchors exactly at the same size of the button.

    Found out it was too hard to exactly place the anchor at the same size (position) of the button corners because it does not snap to corners\edges and if it is placed a little bit wrong the sizes gonna be different from other buttons/elements making it unaligned.

    Using the Rect transform anchor presets the anchors always goes to Button parent size (a panel) which is not correctly set when stretching

    Like this following image:

    Jp0t2om[1].png

    When stretched it looks like this

    REPwBr8[1].png

    And when correctly set and the corners the stretching is correct because it also move the button up as stretch it like this:

    tR7J1XL[1].png

    There are any way to make the anchor snap to the button or any other element (it's own) because it is really hard to exactly match it... or something automatically? (maybe I'm doing it all wrong?)

    PS: While making this question I noticed I could make the anchor as the button and then snap the button to the anchor because this method it snap correctly and then I could hold shift while move the anchor to resize the button with it (but using values would not work)


    Thanks for reading all this book.