Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: AndyGFX on September 16, 2012, 01:22:07 PM

Title: OnEnable/OnDisable
Post by: AndyGFX on September 16, 2012, 01:22:07 PM
I have assigned script to a few game objects with UI childs this script for visibility controll when GUI items are showed:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class VisibleByCheckbox : MonoBehaviour
  5. {
  6.        
  7.         public UICheckbox cb;
  8.        
  9.         void OnEnable()
  10.         {              
  11.                 NGUITools.SetActive(this.gameObject,cb.isChecked);                                             
  12.         }
  13.        
  14.        
  15.         void OnDisable()
  16.         {
  17.                 NGUITools.SetActive(this.gameObject,cb.isChecked);                             
  18.         }
  19.        
  20. }
  21.  
  22.  

but NGUITools.SetActive command enable only parent and not all child objects.

On checkbox is assigned UICheckboxControlledComponent for hide/show GUI groups and workls well, parent and child objects are hide/show.

It's strange.
Title: Re: OnEnable/OnDisable
Post by: ArenMook on September 16, 2012, 07:10:46 PM
Scripts on disabled game objects can't receive events.