I believe this is a bug.
If you create a tween on an object using TweenColor (or any of the other tweening methods), and then later on make a new tween after that first tween has finished, the new tween will have the same eventReceiver and callWhenFinished properties even if you did not set them on the new tween. This is not expected behavior and the easy fix is to just null them both out, but I believe it should be done in the UITweener class and not in our game code.
Example how to reproduce the bug:
Color c = m_label.color;
TweenColor tc = TweenColor.Begin(m_label.gameObject, .5f, c);
tc.eventReceiver = this.gameObject;
tc.callWhenFinished = "MessageDone";
then in your MessageDone function just tween the m_label object again.
Color c = m_label.color;
TweenColor tc = TweenColor.Begin(m_label.gameObject, .3f, c);
That will call the MessageDone method even though we didn't set it, since it reuses the existing tween component.
The fix is to always null out the eventReceiver and callWhenFinished properties on your tweens, but I believe that should be done in UITweener.cs line 255:
static public T Begin<T> (GameObject go, float duration) where T : UITweener
{
T comp = go.GetComponent<T>();
#if UNITY_FLASH
if ((object)comp == null) comp = (T)go.AddComponent<T>();
#else
if (comp == null) comp = go.AddComponent<T>();
#endif
comp.duration = duration;
comp.mFactor = 0f;
comp.style = Style.Once;
comp.enabled = true;
// reset the eventReceiver and callWhenFinished properties
comp.eventReceiver = null;
comp.callWhenFinished = null;
return comp;
}
Thoughts? I am using the tweening class incorrectly?