Author Topic: Calling Button OnClick method by script  (Read 4508 times)

Landci

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Calling Button OnClick method by script
« on: February 02, 2015, 10:42:13 AM »
Hello
i am trying to call the onClick Method from a Button by script and i want to execute the notify elements within the onClick Method.


What i am doing is:

buttonGameObject.SendMessage("OnClick");

so, i can hear the sound of the button being executed but all the notify references i set in the
OnClick Method are not being called, what am i doing wrong?
« Last Edit: February 02, 2015, 11:46:00 AM by Landci »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Calling Button OnClick method by script
« Reply #1 on: February 03, 2015, 10:36:50 AM »
EventDelegate.Execute(button.onClick);

P.S. You may want to look at UIKeyBinding...