Author Topic: Removing or Clearing Old EventDelegates from OnClick  (Read 4652 times)

Arowx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Removing or Clearing Old EventDelegates from OnClick
« on: October 12, 2013, 03:23:20 PM »
Hit an issue with Eventdelegates, I have copies a button already setup to call a specific method when OnClick is triggered.

But the OnClick Notify box just shows None.

It looks like Unity has serialised the EventDelegate information but the NGUI interface is not reading it back and showing it in the editor.

Is there a way to clear old EventDelegate information from buttons or a fix to ensure older information is visible in the editor?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Removing or Clearing Old EventDelegates from OnClick
« Reply #1 on: October 13, 2013, 10:07:18 AM »
NGUI removes invalid data automatically. This generally happens when you do something like have a prefab reference a component outside of it.

Arowx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Removing or Clearing Old EventDelegates from OnClick
« Reply #2 on: October 13, 2013, 02:58:08 PM »
OK it's not a prefab issue as I'm not using prefabs (no blue buttons) and 2 buttons that still work fine show up with None in their On Click fields so there definitely appears to be a case whereby the event delegate is being recorded in Unity but is not displayed in the Editor.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Removing or Clearing Old EventDelegates from OnClick
« Reply #3 on: October 13, 2013, 05:09:59 PM »
I'm not sure the editor shows it, if you set the event delegate in code.

Arowx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Removing or Clearing Old EventDelegates from OnClick
« Reply #4 on: October 13, 2013, 05:18:51 PM »
I'm not setting the delegate in code, I used the IDE's OnClick settings.