Closed GoogleCodeExporter closed 9 years ago
Hi,
I must add this to the FAQ. The problem is due to the tween being created
inside a FOR loop inside a coroutine (which messes up with lambda references -
while as you saw shortcuts work instead). Place your tween creation FOR loop
inside a function and call the function from the coroutine to make it work.
private IEnumerator ShowRippleCoroutine(float delay, Transform targetTransform)
{
yield return new WaitForSeconds(delay);
if(targetTransform != null)
transform.position = targetTransform.position;
m_animating = true;
ResetObjects();
CreateTweens();
if (m_loop)
{
yield return new WaitForSeconds(4f);
StartCoroutine(ShowRippleCoroutine(0, null));
yield break;
}
m_animating = false;
}
void CreateTweens()
{
for (int i = 0; i < RippleSprites.Length; i++)
{
UI2DSprite rippleSprite = RippleSprites[i];
ResetObjects();
Sequence animSequence = DOTween.Sequence();
float interval = i*0.45f;
animSequence.AppendInterval(interval);
animSequence.Append(
DOTween.To(() => rippleSprite.alpha, x => rippleSprite.alpha = x, 1, .35f));
animSequence.Append(
rippleSprite.cachedTransform.DOScale(Vector3.zero, .9f)
.SetEase(Ease.InCirc)
);
animSequence.Play();
}
}
Original comment by daniele....@gmail.com
on 12 Feb 2015 at 8:00
Original issue reported on code.google.com by
bad...@gmail.com
on 11 Feb 2015 at 1:45