- Home /
Question by
Sam-Robichaud · Jun 25, 2012 at 01:36 AM ·
guitexturebutton
Change the texture of a GUI BUTTON
I'm trying to change the texture of a button, and i cant seem to figure out how to do it.
here is a sample of my code
if (GUILayout.Button ( square3, ("label") ) && (gameWin == false))
if (whichSquare == 3)
{
audio.PlayOneShot(applause);
gameWin = true ;
}
else if (whichSquare != 3)
{
// change button texture to square3Wrong
audio.PlayOneShot(buzzer);
}
Comment
Best Answer
Answer by Berenger · Jun 25, 2012 at 02:55 AM
use a private var that holds the current texture you give to the button. At start, initialiaze it with square3, when the button is pressed assing it the square3Wrong texture. While I'm at it, you shoul use { } with the if of your button.
Your answer
