Search Unity

Increase Button Size but Keep Spacing the Same?

Discussion in 'UGUI & TextMesh Pro' started by infinitypbr, Sep 4, 2014.

  1. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Hello,

    I have a button layout for my game, similar to a game pad (diamond shape). In the editor I set up the size to be about how I'd like for a phone, but when I play on the phone, sine the resolution is so great, the buttons end up quite small (like in the bottom image).

    If I allow the buttons to stretch with the screen size change, they end up overlapping each other.

    Is there a way to allow them to grow/shrink based on the screen size/ratio while maintaining their basic layout? (IE, not overlapping)?

    Thanks!!
     

    Attached Files:

  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Have the 4 buttons be in a box that is divided into 4, set the anchors for each button to me at the 1/2 side of each side. Add the buttons, then rotate the parent box.
     
  3. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    I'm not sure what you mean. I added panels and made the buttons children of those. However when they grow in size, they grow in such a way that they overlap, as seen in the photo. However, I don't know if you meant panel when you said box, and I don't know what you mean by divided by 4 and what not.

    Thanks!!
     

    Attached Files:

  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Like in the image here. You can then rotate the container by 45 degrees and use the reference resolution on the canvas :)
     

    Attached Files:

  5. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    That did the trick, thanks!