Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Chaosgod_Espér on December 09, 2012, 07:23:05 PM
Title:
GameObject to UIButton?
Post by:
Chaosgod_Espér
on
December 09, 2012, 07:23:05 PM
hi there..
i´m creating Buttons at runtime with:
NGUITools
.
AddChild
problem now..
i want to set .isEnabled to false, for each created Button.
But this needs a UIButton..
Question:
how to set a UIButton from a GameObject?
LIKE:
ButtonBlocksForeground
=
NGUITools
.
AddChild
(
MainUI_Object, prev_ButtonBlocksForeground
)
;
UIButton Button_BlocksForeground_UI
=
ButtonBlocksForeground
as
UIButton
;
Title:
Re: GameObject to UIButton?
Post by:
ArenMook
on
December 09, 2012, 09:08:33 PM
Use GetComponent<UIButton>(). Check Unity's documentation -- this is just about the most basic and important thing to learn when starting with Unity.