3
\$\begingroup\$

I'm having trouble getting my button to appear correctly, as you can see in the image below, the right and top sides are stretched out and not displaying properly. I cannot figure out if this is a problem with the image itself or something wrong in the way I'm setting up the button.

enter image description here

Here are the settings in the inspector window:

enter image description here

Here is the original image:

enter image description here

UPDATE: So everything looked fine when I just opened up Unity, so I tried to figure out what I did last time for it to make this switch. It happens when I build and export the scene to my Android device.

\$\endgroup\$
2
\$\begingroup\$

Your button is set up correctly and the image is fine it works in a test project of mine and scales properly with all resolutions.

Check the canvas scaler and make sure you are set to scale with screen size. if for some reason that does not work drop it into a panel and scale the panel to custom anchor you min and max and it should scale no problem in every resolution.

EDIT: I added a screenshot of your image here this was taken on a windows phone might be a bug

\$\endgroup\$
  • \$\begingroup\$ I tried this and it did not work. Please see my update though, the problem only occurs after I build and send to android, then it seems like nothing I do has any effect. \$\endgroup\$ – andy mcevoy Feb 4 '15 at 3:48
  • \$\begingroup\$ I added a screenshot of your image working on a Windows Universal Build. It might be a bug on the android builds \$\endgroup\$ – Justin Markwell Feb 4 '15 at 4:34
  • \$\begingroup\$ I'm not sure what to try now, I'm inclined to think it is a bug. Once I've built for android, all the buttons that I add (using that graphic and another similar one) turn out this way. \$\endgroup\$ – andy mcevoy Feb 4 '15 at 15:06
  • \$\begingroup\$ Very strange indeed the build I did will work from 4:3 all the way up to 21:9 and probably more, but it scales fine from phone or pc resolutions all the way to big screen resolutions. Maybe submit as a bug and they may have something to suggest to fix your issue. Another thought is maybe rebuild it in a new scene with fresh canvas and see if it still happens \$\endgroup\$ – Justin Markwell Feb 4 '15 at 16:26
  • 1
    \$\begingroup\$ fairly certain it's a bug now... Everything looks fine if I build for standalone. \$\endgroup\$ – andy mcevoy Feb 5 '15 at 4:27
0
\$\begingroup\$

Tweaking the "Pixels Per Unit" ratio from 100 down to 1, for the asset in question, solved this for me.

Until I did this, all I got was a square / rect without seeing the 8 boundaries of the 9-sliced image... i.e. all I got was the central fill, no 9-slicing as such.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.