Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: IonRift on October 26, 2013, 11:38:51 AM

Title: EventDelegate, UITweener, onFinish not calling?
Post by: IonRift on October 26, 2013, 11:38:51 AM
Hello, I could do with a bit of support as this is starting to take me ages to resolve :

I used to do this to fade and handle things on completion
  1. TweenAlpha twn = TweenAlpha.Begin (transform.gameObject, fadeTime, 1f);
  2. twn.onFinished += new UITweener.OnFinished (fadeInComplete);
  3.  
  4. void fadeInComplete(UITweener tween)
  5. {
  6. // ...
  7. }
  8.  


going through the materials, I figure the updated code should read
  1. TweenAlpha twn = TweenAlpha.Begin (transform.gameObject, fadeTime, 1f);
  2. EventDelegate.Add(twn.onFinished, fadeInCompleted);
  3.  
  4. void fadeInCompleted()
  5. {
  6. Debug.Log ("test 123");
  7. }
  8.  
  9.  


but with the updated code; "fadeInCompleted" is never called.

I can get around it using an anonymous delegate solution from this thread
http://www.tasharen.com/forum/index.php?topic=6265.0

but it's not very neat and I'd like to avoid anonymous things where ever possible.

what am I doing wrong?

Cheers
Title: Re: EventDelegate, UITweener, onFinish not calling?
Post by: ArenMook on October 26, 2013, 08:42:05 PM
You need to make it a public function.
Title: Re: EventDelegate, UITweener, onFinish not calling?
Post by: IonRift on October 27, 2013, 03:28:39 AM
thanks for the suggestion, but
making it public has no effect, it's still not calling.
Title: Re: EventDelegate, UITweener, onFinish not calling?
Post by: ArenMook on October 27, 2013, 04:41:03 AM
Wait, which version of NGUI are you using? Make sure you're on 3.0.3.
Title: Re: EventDelegate, UITweener, onFinish not calling?
Post by: IonRift on October 27, 2013, 06:00:09 AM
hmmm, yeah doing a test in a clean project works fine - so this problem is due to version limbo...

cheers Aren
Title: Re: EventDelegate, UITweener, onFinish not calling?
Post by: IonRift on October 27, 2013, 07:52:56 AM
....or, or ... it's got nothing to do with NGUI and instead has everything to do with me overriding the onFinish function elsewhere

yeah, sorry false alarm. I seem to be a bit slow of late :[