- Home /
How to draw a transparent texture in GUI?
Hi! I have a .png picture which background is transparent. When i draw it in GUI the background became all white, not transparent. Is there any way to solve that problem? THX!
Answer by salvador007 · Apr 17, 2014 at 12:45 PM
Simply Click on your Texture >>In INSPECTOR change Texture Type : GUI apply settings
it will work fine...
Answer by squall_789 · Aug 30, 2010 at 05:04 PM
Hi.
I also had the same problem, I managed to find the following shader help within the spaceinvaders project. see link here Invaders Project
You could also paste this code into a shader to achieve the same effect.
http://www.unifycommunity.com/wiki/index.php?title=AlphaSelfIllum
or alternitivly try this for double sided
http://www.unifycommunity.com/wiki/index.php?title=AlphaDiffuse2sided
or this that doesnt work with blending, so its a little faster to use. http://www.unifycommunity.com/wiki/index.php?title=UnlitAlpha
Hope that helps a little.
Wow, thats really comprehensive! But honestly speaking, the codes are too hard for me to understand. I'm still a beginner, so sorry. Could you please tell me how to use these scripts to let my .png file become transparent?
Hi. If you just click the invaders Project Link I've provided, download it, and inside there is the shader i've mentioned, simpley copy and paste it into your project folder, then when selecting a material select the new material. I'm also a beginner so don't worry about it, this also took me a few $$anonymous$$utes to figure out.
Hi! I copied the shaders folder to my Unity Object assets folder, and create a new material with my transparent .PSD file(I dont know whether theres difference between .png and .psd or not). I havent figure out how to use a material on GUI, so i just simply attached it to a plane. But none of the three shaders i imported could make the plane become transparent. But in "Invaders", I truely see the transparent plane, like "buttoncontrols" under "buttonbase" in Scene "title". Is there any step i miss? THX.
$$anonymous$$aking a transparent SHADER is easy and it comes with Unity. The original question asks, and still hasn't been answered, how to keep transparency on texture import to be used with UI elements. That means NO SHADER.
Answer by jtbentley · Aug 30, 2010 at 02:51 PM
Either the alpha isn't working properly, or you're not select the correct import option. Ensure you chose RGBA (24bit, 16bit, dx/pvrt, doesn't matter) for whichever method of compression you chose.
I choose the RGBA, but it still doesnt work. I realize something, my Unity is free version, does it support transparent textures?
Answer by musaranya · Apr 17, 2014 at 09:41 AM
Select your png in the project panel. In the Inspector panel you will see the import settings, make sure you select GUI in the Texture Type dropdown, and then click Apply. This way your texture will keep its transparent background when using it as GUITexture
Your answer
![](https://koobas.hobune.stream/wayback/20220613072342im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cooldown indication, transparent rotating texture 1 Answer
Transparent & self illumin object? 1 Answer
Edges on Transparent GUI - Still not working 1 Answer
OnGUI Button 1 Answer
GUITexture Button? 1 Answer