uhmp i dont know how to change the color of text in a gui (and if you know plz tell me how to change the color of the whole box)
i got a script but where to place:
guiTexture.color = Color.blue;
guibutton.js:
unction OnGUI () {
// Make a background box
GUI.Box (Rect (10,30,100,320), “Options”);
// Make the first button.
if (GUI.Button (Rect (20,60,80,20), “Light”)) {
print (“Lights not available yet !”);
}
// Make the second button.
if (GUI.Button (Rect (20,120,80,20), “Character”)) {
print (“Character not available yet !”);
}
hi, it isnt working… if i place it under ongui it will say
as a error:
MissingComponentException: There is no ‘GUITexture’ attached to the “Options Button (GUI)” game object, but a script is trying to access it.
You probably need to add a GUITexture to the game object “Options Button (GUI)”. Or your script needs to check if the component is attached before using it.
You are using guiTexture.color, it’s only affects the guiTexture component and the script error says you have no guiTexture component attached to that object. You have to use gui.color as emadgh said.
function OnGUI () { // GUI STARTS HERE
GUI.color = Color.blue; // makes gui color blue
// Make a background box
GUI.Box (Rect (10,30,100,320), "Options"); // MAKES A BOX
// Make the first button.
if (GUI.Button (Rect (20,60,80,20), "Light")) { // MAKES A BUTTON
print ("Lights not available yet !"); // GETS EXECUTED WHEN THE BUTTON IS PRESSED
}
GUI.color = Color.red;
// Make the second button.
if (GUI.Button (Rect (20,120,80,20), "Character")) {
print ("Character not available yet !");
}
}