Hi!
I am using NGUI3.6.8.
Run the code below.
"OnFinish2" is called at the time of "OnFinish1."
[RequireComponent
(typeof(UIPlayTween
))] public class PlayTweenTest : MonoBehaviour
{
UIPlayTween pt;
void Start()
{
if (pt == null)
pt = GetComponent<UIPlayTween>();
TweenPosition
.Begin(gameObject, 5f,
new Vector3
(1f, 0f, 0f
)); EventDelegate.Add(pt.onFinished, OnFinish1, true);
pt.Play(true);
}
void OnFinish1()
{
Debug.Log("OnFinish1");
EventDelegate.Add(pt.onFinished, OnFinish2, true);
pt.Play(false);
}
void OnFinish2()
{
Debug.Log("OnFinish2");
}
}
The cause is "EventDelegate.Execute" of for statement.
for statement running, list change, It is not to operate as expected.
I was changed to a secure code.
There was a problem.
"UITweener.duration = 0".
"OnFinish2" is not called.
It was troubled.

EventDelegate.Execute
----------------------------------------------------------------------
[NGUI3.6.8]
for (int i = 0; i < list.Count; )
{
EventDelegate del = list[i];
if (del != null)
{
del.Execute();
if (i >= list.Count) break;
if (list[i] != del) continue;
if (del.oneShot)
{
list.RemoveAt(i);
continue;
}
}
++i;
}
----------------------------------------------------------------------
[Change]
foreach (var del in list.ToArray())
{
if (del != null)
{
del.Execute();
if (del.oneShot)
list.Remove(del);
}
}
----------------------------------------------------------------------