Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: reptilebeats on July 16, 2012, 05:58:49 PM

Title: one way to call the uiwidget
Post by: reptilebeats on July 16, 2012, 05:58:49 PM
hey quick question is their a way to call the UIWidget to be disabled or enabled without having to define what it is,

so instead of using gameObject.Find("cube").getcomponent(UILabel).enabled =true;

i could use gameObject.find("Cube").getcomponent(ui).enabled = true;

so basically one word for any uiwidget placed in a panel to make life easier a bit like the getcomponent.collider
Title: Re: one way to call the uiwidget
Post by: ArenMook on July 16, 2012, 06:40:26 PM
All UI components derive from UIWidget, but you can't just say "disable all widgets". There is no such functionality in Unity. Instead you can GetComponentsInChildren<UIWidget>(), then foreach through them and enable = false on each of them.
Title: Re: one way to call the uiwidget
Post by: reptilebeats on July 16, 2012, 06:51:25 PM
yh thats what i have a simple loop to go through each one, but when i used UIWidget enabled == false worked fine but when enabled == true, it comes up saying guitexture was not found.

im switching my old unity gui to ngui so something must be tagged wrong, or theres something in my code thats mucking it up. just wanted to check that it is UIWidget and not something else before i started looking
Title: Re: one way to call the uiwidget
Post by: ArenMook on July 16, 2012, 07:24:24 PM
GUITexture is a Unity class, not an NGUI class.

UITexture is an NGUI class.
Title: Re: one way to call the uiwidget
Post by: reptilebeats on July 16, 2012, 07:39:52 PM
yh exactly thats why i was getting confused, as the code would work if i didnt use UIWidget but used UILabel instead.

i think i found out what it was though, i had a guitexture not showing as i deleted the texture on another level, and i haven't been on this level for a long time so i forgot it was there.