Author Topic: Please add inspector OnClick event into Image Button  (Read 5322 times)

Jofator

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Please add inspector OnClick event into Image Button
« on: October 29, 2013, 04:29:05 AM »
Will you please add inspector OnClick event into Image Button as UIButton has?
It's very helpfull and you can do it by few lines of code:

Add into UIImageButtonInspector at the end of OnInspectorGUI:

      GUILayout.Space(3f);
      NGUIEditorTools.DrawEvents("On Click", mButton, mButton.onClick);   



And add into UIImageButton:

   using System.Collections.Generic;

   static public UIImageButton current;
   public List<EventDelegate> onClick = new List<EventDelegate>();
   
   void OnClick ()
   {
      if (isEnabled)
      {
         current = this;
         EventDelegate.Execute(onClick);
         current = null;
      }
   }
Jofator

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Please add inspector OnClick event into Image Button
« Reply #1 on: October 29, 2013, 04:55:25 PM »
I'm actually going to get rid of the image button script in a future update. Its functionality will be merged with UIButton.