I’m trying to make a plain GUI button that is blue, with no text on it.
Here is my code,
var btnTexture : Texture;
var btn_Color : Color.blue;
function OnGUI() {
if (!btnTexture) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
GUI.Color = Color.blue;
if (GUI.Button(Rect(10,70,50,50),btnTexture))
Debug.Log("Clicked the button with an image");
if (GUI.Button(Rect(10,10,100,30),"Test"))
Debug.Log("Clicked the button with text");
}
Unity says that “The color blue does not denote a valid type.”
I’m going to have multiple colored buttons in this script. Red, orange, yellow, green, blue, and purple. Is there a way I can make it so each button has a different color? Also, how do I even make the button have color because Unity makes an error.