Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

UI Button - Sliced image has wierd stretching effect on top and right?

Discussion in '2D' started by mcevoy-andy, Feb 3, 2015.

  1. mcevoy-andy

    mcevoy-andy

    Joined:
    Feb 3, 2015
    Posts:
    13
    I'm trying to make simple sliced button but cant figure out what's going on...



    As you can see the top and right are very stretched out, but I can't figure out why. Could it be something to do with the image itself?

    Here's my button settings in the inspector:

     
  2. elgarstorm

    elgarstorm

    Joined:
    Dec 13, 2012
    Posts:
    3
    I was wrestling with a similar issue in a game I am making. It seems that the setting of borders on the image in this way only works well if the size of the original image is a power of 2. This could be due to a bug in Unity, I'm not sure. I am using an image with a very similar structure to what you have there. So I hacked the source image to have a size of 128x128 (rather than the 50x50 that I had originally) and now it works as expected.
     
  3. thedarcsage

    thedarcsage

    Joined:
    Nov 2, 2016
    Posts:
    23
    Yup, the power of 2 was the issue. I resized the original image, reimported, resliced, et voila, it worked for me. Thanks!