Hi people,
i tried few days but i can’t find a way to deal with my pb.
i searched on forums and here and tried the solutions explained with no result.
Maybe i’m missing something…
i have a GuiTexture filled with a texture.
this texture is done in Photoshop with one layer and has empty pixels.
using getpixel(), i test the alpha channel. the problem is :
- If the texture has no empty pixel all is fine, i obtain the good RGB and A value.
- If the texture contains empty pixels, the alpha value of any pixel of the whole texture is definitively 0 and it seems that the same color fully fills the texture even if visually, in the game, the texture has transparent and non transparent zones.
i understood that there was something weird with photoshop and Unity about this point.
Waht i’m looking for is a way to correctly import in unity a texture with transparent and non transparents zones and be able to use it using getpixel.
Thank you for your help.
You should GuiTexture with Photoshop with one layer on it. I’ve recently tried it when I was creating a custom logo design for my client and it worked well.
Hi Mario, thanks for your reply.
Based on what you suggested
1-
a) i created a full transparent layer that i put on the top of my texture (a white form with empty pixel all around),
b) I saved it as psd: the getpixel function returns RGBA = 1.0000, 1.000, 1.000, 0.000
2-
a)i fully red colored the “on the top” layer (not transparent anymore)
b) saved it as psd: only this red “on the top” layer appears under unity, white form doesn’t appear anymore. The getpixel function then returns RGBA = 1.000, 0.000, 0.000,0.000
3-
a) i destroyed the red “on the top” layer.
b) i duplicated the layer with white form and empty pixels.
c) then i colored to red the white form. i obtain a layer with a red form and empty pixels on the top of the layer with white form and empty pixels. the two forms perfectly match.
d)I saved it as psd: The getpixel function then returns RGBA = 1.0000, 1.000, 1.000, 0.000
- i repeated the same steps described in 1, 2, 3, with the layer with a white form and empty pixel on the top (the steps 1,2,3 were with it on the bottom).
My conclusion is that in all cases, the rect of the GUItexture is fulled with only one color even if in the game, I can see a form with transparency around. in this particular case it seems that a invisible layer is always on the top, and this one has on ly one color and alpha channel = 0.000. it would be great if i only wanted to see the form ans the transparency. But What i need is to be able to retrieve the RGBA of the pixel i’m clicking on. sadly, even if i clicked on a visible white pixel, i obtain pixel information from the “invisible” layer added by unity.