So I understand that I just asked for how to store a GUI colour in a variable, but I couldn’t get it to work in the way I needed it to.
I wanted a button that changes it’s colour if you click on it. Here’s what I tried:
function OnGUI () {
GUI.color = Color.green;
var colourGreen : Color = GUI.color;
if(GUI.Button(Rect(Screen.width/1.8, Screen.height/1.8, 100, 50), "Green"))
{
colourGreen = true;
}
}
Unfortunately this just changes the button from the start. Also, this should work for all of the buttons I have. I just used one button so that it would shorten the question. Hehe!
I understand that this should return an error, but I hope that you all understand what I’m trying to do, so if anybody knows how I can do this, then please show me in the answers section! Thanks!