- Home /
Sprite packer + 9-slice + alpha = bug
Using Unity 2018.2.5f1
Our UI artist created a button with a large glow effect that fades alpha out quite far. This button is also integrated with the 9-slice feature so it can properly scale horizontally. I created a sprite atlas and added our UI elements including that particular button.
When I look at the atlas preview, it seems fine. At runtime, that button bleeds a lot and displays some garbage at the bottom. I tried to increase the padding to 8 but it has little to no effect.
After investigation, I came to the conclusion that this might be a bug in the sprite packer. Maybe there is a hidden process that evaluate where to crop the pixels based on an undefined alpha threshold.
The issue is that the new height of that image doesn't match with the height specified in the 9-slice settings of that sprite.
Answer by Dazo1985 · Oct 15, 2019 at 01:04 PM
Get sure there is empty alpha on each edge of the image. If there is one side touching the end of the image size it creates this issues.
Answer by etaxi341 · Oct 15, 2019 at 01:21 PM
That is normal behaviour if your Texture isn't pixelperfect and there are no margins
Can you explain what you mean by that? How do you set a Sprite/UI 2D texture to "pixelperfect"? This option is only in Camera settings.
I'm experiencing similar weird issues with 9-slice, and even removing them from the atlas has not fixed it. Only happens in WebGL builds.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182853im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI atlas icon artefact 0 Answers
9 Sliced Image Is Bleeding Edges 0 Answers
Questions about Sprite Editor and Atlas, iOS 0 Answers
How To Slice The Picture Made By Sprite Packer? 0 Answers
Get a sprite from a Sprite Packer atlas? 2 Answers