Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Button Interaction Area is not flush to the buttons

Discussion in '2D' started by BoldElf, Sep 19, 2019.

  1. BoldElf


    Sep 19, 2019
    HI all I hope this is the right area to ask this question. I am having an issue with UI.

    I am using the 2D platformer template option that you get to chose when making your first game in unity and I am trying to imput custom button UI. I have managed to replace the text with sprites I have created and keep the aspect ratio. How ever when I try to make the rect area smaller so it is flush with the image it shrinks the sprite.

    All I want to do it make the interaction area exactly the same size as the sprite beacuse at the moment I can click a dead zone to the left or the right of a button and it still works when it shouldnt.

    This might be an issue to do with useing the premade game instead of making stuff from scratch but I would like to know how to fix it just incase I run into the same issue in the future.

    I have attached some images to help display what the issue is.

    Please note I can make the selection area bigger without it effecting the image if I turn off Horizontal laoyout group with no problem but not shrink it.

    Attached Files: