Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: xproject2013 on September 27, 2013, 08:44:08 AM

Title: nGUI how to deactivate UICheckbox by script?
Post by: xproject2013 on September 27, 2013, 08:44:08 AM
Hi, I'm new to nGUI (2.7), I'll explain shortly what I'm doing: I'm using a UIButton with UICheckbox script attached to make it stay selected when pressed. Another button has the duty to disable this button selected returning it to its initial state. In order to do this I created a script but the checkbox button doesn't return to its initial state (the checkmark sprite still active) despite the value isChecked it return false, can someone help me? Below you can see the script that I used, thanks in advance!

 
  1.  public void checkboxInitialStyle (){
  2.          UICheckbox checkbox = GameObject.Find("PressedButton").GetComponent<UICheckbox>();
  3.          if (checkbox != null) {
  4.               checkbox.isChecked = false;
  5.          }
  6.     }