Author Topic: EventDelegate Callback Non-Monobehavior  (Read 3337 times)

PickySalamander

  • Guest
EventDelegate Callback Non-Monobehavior
« on: October 18, 2013, 10:05:39 AM »
I started upgrading my project to NGUI 3.0.2 today from 2.7 and I've run into a problem with EventDelegates. I rely on PlayMaker pretty heavily and I have a custom PlayMaker action which adds a NGUI TweenAlpha to a panel and fades it out. Basically the problem is, since Playmaker action code doesn't run on a Monobehavior, the EventDelegate won't execute.

My solution was to alter EventDelegate's code so that it stored the original callback as a backup in case the target can't be found. Is there another way to avoid this and if not could this possibly be fixed in a future update?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: EventDelegate Callback Non-Monobehavior
« Reply #1 on: October 18, 2013, 04:27:03 PM »
Why don't you have TweenAlpha there to begin with, simply disabled? You will be able to call its PlayForward function from playmaker and/or another tween.

PickySalamander

  • Guest
Re: EventDelegate Callback Non-Monobehavior
« Reply #2 on: October 21, 2013, 08:24:17 AM »
The issue is less knowing if the Tween started but knowing when it's finished. For example on of the operations I'm using it for is fading out a screen and fading in another. I listen the OnFinished event to fade in the next menu after the tween is complete. Since though I'm making this call from outside a MonoBehavior the OnFinished event never calls my delegate.