You are probably looking for gameObject.activeSelf
, (a comment mentioned obj.active
which is deprecated).
So iterate through your listitems something like:
foreach (var item in listitems) // this is pseudocode, not sure of the actual types
{
if (item.gameObject.activeSelf){
// Congrats you have your active item
}
// the item is not active
}
item
in this context is the actual NGUI component that you are referencing, in Unity everything has a recursive lookup to it's parent game object, and it's parent's parent game object and so on. You can literally have a label on a nested game object and get down to the root by doing something silly like label.gameObject.gameObject.gameObject
etc...
If you are just referencing the game object itself or a list of game objects, then just omit the item
in my code.