- Home /
Question by
VDTruck · Feb 28, 2013 at 04:23 PM ·
drawtextureopacity
Opacity for DrawTexture not working
Hello! I tried this: colPreviousGUIColor = GUI.color; in start() and in OnGui() I have this:
GUI.DrawTexture(Rect(Screen.width-205,Screen.height-195,60,60), ceas, ScaleMode.StretchToFill, true, 10.0f);
GUI.depth = 1;
GUI.color = new Color(colPreviousGUIColor.r, colPreviousGUIColor.g, colPreviousGUIColor.b, opacitate);
Even if I change the "opacitate" variable, the opacity it's same.
Also I tried GUI.color.a = opacitate, but neither this not worked too.
What can I do? Thanks!
Comment
If this is how your code is written, you are setting the color after you make the GUI.DrawTexture() call. Set the color before the call.
Answer by Jason-King · Dec 27, 2013 at 03:48 AM
If you are trying to do a form of the "fade to black" method commonly found on the web by creating a Texture2D and using SetPixel, then you will also need to call Apply on the Texture2D after having called SetPixel.
Your answer