Hi, I’m attempting to make a main menu, and here is the button I have in photoshop CS6:
I know its not the best looking in the world, but its temporary. Now, if you see in the red circled area, that I have sort of a cut-off corner look going, and it is indeed transparent. Now, when I import this into Unity, I am putting it on a plane, because I cannot just drag and drop the PNG into the scene. (If anyone knows better ways to import a PNG, please share) However, when I import it, the corner is not transparent like it is in photoshop.
As you can see, there is still black in that little cut-off area. Help please?
There are two things you must do in order to get transparency. First you must have an import setting that saves the alpha channel. Select your texture and in the inspector set Texture Type to “Advanced,” turn off “Generate Mip Maps” and Set Format to RGBA 32 bit. These may not be the setting you want to ship with, but they are a starting point that gives you transparency and high quality.
If this does not fix your problem, you will need to change your shader on the material you use for your images. Only some of the shaders support transparency. You can start with the Unlit/Transparent shader.
I tried this and it worked:
Select texture, in the inspector set Texture Type to “Texture”, check Aplha from Grayscale, you will see Alpha is Transperancy under it check that too. Done.
For everybody who might tumble over this thread:
In photoshop it helped for me to put an additional, empty, transparent layer as a background. Somehow with that empty extra layer, unity will recognize the transparency
So save your image with transparency as explained above, then simply drag it into your assets folder, change Texture Type to “Sprite (2D and UI)” and hit the Apply-Button at the very bottom of the Inspector, it should convert the image just fine then
I find this whole PNG transparency unnecessarily awkward with Unity3d (5.6). You really must experiment with more than a few export settings in whatever graphics program you are using. Since I use Paint Shop Pro here is all I found that worked consistently: Create image with transparency…
Save As PNG/select Options button/check non-interlaced, non-optimized radio buttons/Run Optimizer/Run Wizard/Next/Next/Use Existing Transparency area/Next/Use the eye dropper to pick the transparent color in your image/Next/Verify in preview it looks the way you want —> Click Finish
Looks more complicated than it is but it works.
In Unity Import Asset/Your.png/select ‘index texture alpha’ and alpha is transparency/uncheck generate mip maps/click apply.
Create a material and drag the png into the albedo field and select Shader/unlit/transparent cutout
HINTS: For each unsuccessful attempt you make, be sure to delete the previous file and input the asset with a new name so Unity3d sees it as a completely unique file. I wasted time, over-writing my initial imports which kept coming in with pink (a sign all is not well) where the transparency should have been checkered.
Admittedly this is a Paint Shop Pro specific solution but there may be others frustrated with PNG imports into Unity3d 5.6 Cheers!
I just solved this issue in Unity 2018.3.7 doing this:
- open the png in Photoshop, change Mode from Index RGB
- select and deleted the white background
- change Mode from RGB to Index
- export as PNG
- import in Unity Sprite (2D and UI), Alpha source=> Input Texture Source, Alpha is Transparency
- Generate Mip Maps => off
Hope this helps others !
I don’t have Photoshop or Paint Shop Pro, only Photoimpact and the options for this png seemed to be greyed out. My son wants the transparent background of this png,which was transparent in MIT’s Scratch, to be transparent in Unity. Advice would be gratefully received.
If none of the above aswers works for you, then maybe is the settings of the image component on the gameObject in which you are using the png file. Try set the ‘Image type’ to ‘Simple’ in the Image component and then check the ‘Use sprite mesh’. This worked for me. Hope this is useful to somebody.
use TIF. TIF is slightly larger in file size. 1024x1024 texture png = 1mb, same TIF is 1.3 mb. Unity has no problem reading the TIF alpha channel. Not sure for sprites, just speaking generally.