Author Topic: Access NGUI button's notify(OnClick)  (Read 6692 times)

Lumind

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 14
    • View Profile
Access NGUI button's notify(OnClick)
« on: June 02, 2014, 07:44:26 AM »
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? And just to be clear - I need to change the button's notify(target), not the function
 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Access NGUI button's notify(OnClick)
« Reply #1 on: June 02, 2014, 11:03:34 PM »
You should not be altering only the target because it's a part of the delegate, which is a combo of object + function name.

Take your pick:
  1. EventDelegate.Set(button.onClick, YourFunction);
  1. EventDelegate.Set(button.onClick, someScript.YourFunction);
  1. EventDelegate.Set(button.onClick, new EventDelegate(someScript, "FunctionName"));

Lumind

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Access NGUI button's notify(OnClick)
« Reply #2 on: June 03, 2014, 02:05:02 AM »
thanks, that helped)