- Home /
The question is answered, right answer was accepted
transparent background with GUI.DrawTexture
Hi !
Sorry for my bad english, it is not my native language...
I want to display a texture with GUI.DrawTexture. This texture has transparency, but when I display it, the background (set to transparent thanks to PhotoFiltre) is displayed with white color (color without transparency). I thought I found the solution here: other topic, but the "GUI" texture type is not suggested in my texture inspector: there only is "Editor GUI and Legacy GUI". So I selected this one, with "trueColor" format as in the other topic, but it didn't work. In addition, it is written in the bottom of the inspector on the preview "RGB 24 bits". The only way I found to get "ARGB 32bits" is selecting "Advanced" texture type, and selecting "Alpha from grayscale". But of course, the alpha is according to Grayscale, and not to the source alpha channel...
Another way to solve this problem is to set a color as transparent, so that the background (color = (255,255,255)), is transparent, without caring about the source transparency. But I don't know how to do that...
Please help me ! Thx.
Normally, you only need to import is as Legacy GUI. If the image has been saved as a PNG with it's transparency intact, it should show correctly when drawn with GUI.DrawTexture.
The problem is that with these parameters, it displays "RGB 24 bits" That means that the problem is not in scripting: even if it could, it would have no information to get alpha channel...
I don't know about your Unity version, but I use the latest one and if I import a PNG image with transparency as Editor GUI and Legacy GUI, it reads "ARGB 32 bit" and the transparent area shows correctly in the preview (or rather, it doesn't show and the white-grey checkerboard background is visible).
If you view the file with an image viewer, does it show corretly with transparency intact?
Follow this Question
Related Questions
How to place/add a HD image/picture in background of my game? 0 Answers
background GUI texture 2 Answers
Changing Font, Background/Style of GUI Buttons 1 Answer
Creating a GUI Button background texture 2 Answers
Gui appear and then fade to black 1 Answer