Question by
miladloveboth · Jan 31, 2016 at 03:22 PM ·
buttononclickclicks
hi guys who can help me?(i am a persian boy so ... Readable plzz)
I want a click of a button : enabled a button= true and a second click : enabled the button = false
++++++++++++++++++++++++++++++++++++++++ i dont know english and i need to help u guys.
Comment
Answer by haiderInUnity · Jan 31, 2016 at 06:07 PM
What i understand is you want to enable and disable button on mouse click. for that you can do something like this
public Button myButton; // assign this button in the inspector
void Update ()
{
if(Input.GetMouseButtonDown(1))
{
myButton .enabled = !myButton .enabled;
}
}
you will need to drag the button from the hierarchy to the inspector. Hope it helps @miladloveboth