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
TweenAlpha twn
=
TweenAlpha
.
Begin
(
transform
.
gameObject
, fadeTime, 1f
)
;
twn
.
onFinished
+=
new
UITweener
.
OnFinished
(
fadeInComplete
)
;
void
fadeInComplete
(
UITweener tween
)
{
// ...
}
going through the materials, I figure the updated code should read
TweenAlpha twn
=
TweenAlpha
.
Begin
(
transform
.
gameObject
, fadeTime, 1f
)
;
EventDelegate
.
Add
(
twn
.
onFinished
, fadeInCompleted
)
;
void
fadeInCompleted
(
)
{
Debug
.
Log
(
"test 123"
)
;
}
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 :[