- Home /
Change image GUITexture color
Hi everyone !
I don't know how can I manage that. I have an image in a GUITexture and I would like to change the color of this image. How can I do this ?
Thanks :)
Answer by Ashkan_gc · May 04, 2011 at 04:57 PM
it's easy. there is a tint color property in it's inspector and you can change it in code using color property. attach a script like this to the object containing GUITexture
GetComponent(GUITexture).color = myCol;
where myCol is a Color variable with values you want. you can change the color whenever you want. as you might know with methods like HitTest you can see if the mouse pointer is on your GUITexture or not to change the color and do other stuff.
The problem is that I have my GUITexture and I would like to drow it with GUI.DrawTexture methode but it seems that this method doesn't like GUITexture type :( BTW thanks for your answer :)
GUI.DrawTexture take a Texture2D as an argument. simply take the texture itself to it. change GUI.color before calling DrawTexture to change tinting color.
Your answer
Follow this Question
Related Questions
Image Background Problem 1 Answer
Making GUITexture start transparent then fade in. 1 Answer
How to change the color of an image every two seconds 1 Answer
Get color of pixel at mouse click of a GUITexture 2 Answers
How can I display a flat background - 2D image, not a skybox - behind everything in my camera? 4 Answers