Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bloobmob on April 27, 2014, 02:12:34 AM

Title: Ngui Button script question
Post by: bloobmob on April 27, 2014, 02:12:34 AM
When I use the button script is there a way to leave the button pressed and the unpressing it?
Title: Re: Ngui Button script question
Post by: Sahkan on April 27, 2014, 11:31:02 AM
You can use an extra object ( Let's say an empty ) which will hold a boolean and will change it's property each click .
And just put that object in the UIButton section in the Button object ( In "On Click -> Notify" ) and then chose the function which change the variable for that boolean in the method section that will open gor you ones you drug the new object in it .

In the new object you should put some function like that :

  1. bool Clicked = false;
  2.  
  3. public void BoolChanger() //make sure to make the function public so you can access it via the inspector !
  4. {
  5. if(Clicked)Clicked = false;
  6. if(!Clicked)Clicked = true;
  7. }
  8.  
Title: Re: Ngui Button script question
Post by: ArenMook on April 27, 2014, 11:56:49 PM
Leave the button pressed? That sounds like a toggle, not a button.