Author Topic: EventDelegate, UITweener, onFinish not calling?  (Read 5928 times)

IonRift

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
EventDelegate, UITweener, onFinish not calling?
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: EventDelegate, UITweener, onFinish not calling?
« Reply #1 on: October 26, 2013, 08:42:05 PM »
You need to make it a public function.

IonRift

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: EventDelegate, UITweener, onFinish not calling?
« Reply #2 on: October 27, 2013, 03:28:39 AM »
thanks for the suggestion, but
making it public has no effect, it's still not calling.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: EventDelegate, UITweener, onFinish not calling?
« Reply #3 on: October 27, 2013, 04:41:03 AM »
Wait, which version of NGUI are you using? Make sure you're on 3.0.3.

IonRift

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: EventDelegate, UITweener, onFinish not calling?
« Reply #4 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

IonRift

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: EventDelegate, UITweener, onFinish not calling?
« Reply #5 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 :[