- Home /
Changing Texture's Color
Hello~
I'm trying to change Texture's color.
I can do it by Creating a GUI Texture and setting color wanted to the Texture in Inspector window.
Problem is, I have some GUI buttons created in JavaScript. I could use two Textures (one for normal, one for active) to make the button change when I click on it. But now, I want to use only one Texture to achieve this. So I think the best way is change the color of the Texture when I click on it. Some people said that we could implement this by using GUISkin or GUIStyle, I think the second method is using two different Textures,,
So.. Can any one please tell me how I can work this out?.
Thanks! ^.^
Answer by Eric5h5 · Apr 18, 2010 at 10:40 PM
If it's "GUI Texture" as in GUITexture, then do guiTexture.color = whatever. If you mean a texture as drawn in OnGUI, then change GUI.contentColor.
Thanks! I meant a texture as drawn in OnGUI,,It's exactly what I'm looking for , But Unfortunately I still have no idea with how to use GUI.color to implement button's color changing when I clicked on.. I use "GUIStyle.normal.background = texture1; GUIStyle.active.background = texture2; GUI.Button(Rect (blah) ,"", GUIStyle)" .. I think the method using GUI.color doesn't make sence in this way.. What do you think, Eric?
@Jin, set a boolean if the button is clicked and use the boolean to change the color or not.
Your answer
Follow this Question
Related Questions
Edit the color/properties of Gui border 0 Answers
How do I change the font and color of GUI text? 0 Answers
How to have correct color on imGUI Buttons (as dynamic textures) avoiding multiply effect ? 1 Answer
Same BackGroung For All Screen Resolution 1 Answer
Load an image from www and save it for offline use 0 Answers