Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: abhaya.agrawal on July 10, 2015, 10:07:22 AM

Title: add function on button at runtime
Post by: abhaya.agrawal on July 10, 2015, 10:07:22 AM
I want to add function at runtime on UiButton which is in another script

gameObject.GetComponent<UIButton>().onClick.Add(new EventDelegate(another_script_obj, "Call_Ui_Check_Collision()"));

its not working.
Title: Re: add function on button at runtime
Post by: ArenMook on July 12, 2015, 07:55:56 PM
Get rid of "()" and use EventDelegate.Add, not onClick.Add.