- Home /
The question is answered, right answer was accepted
How can I use a PNG with transparency as a button?
Hello
.
I am trying to use a png file with transparency (basically a circle that fades out towards the center) as a button on my Canvas. I have tried and googled for a while now and I haven't gotten any further.
.
I have tried various ways, including making the image into a sprite and adding it to the button, but then it loses the transparency (even though in the import settings I checked the Alpha is Transparency option.
.
I attached an image illustrating my problem... I will greatly appreciate any help!
.
Please increase the size to 32x32 or 64x64. It is too small. 4x4 has only 16 pixels.
Answer by mrietschel · Jan 19, 2019 at 11:10 AM
Ok I figured it out myself: I couldn't use the texture on the Button because I imported it as a texture, not as a sprite. Once I changed the Import settings to Sprite/UI 2D it was no problem to add it as the button's sprite.
And the _Circle sprite was just a white sprite created by unity, that had nothing to do with my texture. When I changed the import settings to sprite, my texture became a sprite object, just like the _circle in the pictures.
Answer by sujitmarcus · Jan 19, 2019 at 07:30 AM
On Button Script Change Transition from color tint to Animation and animated its alpha to transparent with Trigger Parameter.
Follow this Question
Related Questions
Keep button pressed after selection 3 Answers
Get current sprite from filled Image PRESERVING ITS TRANSPARENCY 0 Answers
Scaling problem with image on buttons. 1 Answer
How to play a Video IN a UI Button / as a Button? 0 Answers
how can I change the source image on a UI button in JS code? HELP? 1 Answer