- Home /
Access NGUI button's notify(OnClick)
In old NGUI version I had UIButtonMessage script on my button. Button's target was changeable - when I clicked on some object, it became the button's target. But now I try to access NGUI button Notify when OnClick. I haven't found it in button's script, so how can I change the button's Notify (OnClick) through my script?
Answer by fffMalzbier · May 30, 2014 at 11:54 AM
You could use the UIEventListener.cs
Event Hook class lets you easily add remote event listener functions to an object. Example usage: UIEventListener.Get(gameObject).onClick += MyClickFunction;
I'm sorry, it's absolutely unrecognized part for me (I've never used that). Can you please tell me: to what object I need to attach UIEventListener.cs - button or objects that have scripts with the needed function? And just to be clear - I need to change the button's notify(target), not the function
Your answer
![](https://koobas.hobune.stream/wayback/20220613150239im_/https://answers.unity.com/themes/thub/images/avi.jpg)