1
DOTween & DOTween Pro / [DOTweet PRO] - Problem with DOOffset(): only first call succeeds....
« on: May 09, 2016, 05:07:07 AM »
Hi,
I use DOOffset() to scroll a Texture, but only the first call succeeds, others don't give errors, but the Texture does not move..
What am I missing... ?
void Spin(int spinNum, Ease ease)
{
var tween = GetComponent<Renderer>().material.DOOffset(new Vector2(0, 1), 1f);
tween.SetEase(ease);
//loop completed:
tween.OnComplete(() =>
{
spinNum--;
if (spinNum >= 1)
Spin(spinNum, ease); //next spin loop
else
IsSpinning = false; //finished !!
});
}
I tried with a For loop but with the same result, only the first call get executed, the others seems to be ignored..
IEnumerable Spin(int spinNum, Ease ease)
{
for (int i = 0; i < spinNum; i++)
{
tween = GetComponent<Renderer>().material.DOOffset(new Vector2(0, 1), 1f);
tween.SetEase(ease);
yield return new WaitForSeconds(1f);
}
}
I shared a complete small demo here:
https://onedrive.live.com/redir?resid=150B61C7D2D5A9BA!471158&authkey=!AFMymBYFnKNhMQw&ithint=file%2c7z
Please help.
Thanks a lot.
David
I use DOOffset() to scroll a Texture, but only the first call succeeds, others don't give errors, but the Texture does not move..
What am I missing... ?
void Spin(int spinNum, Ease ease)
{
var tween = GetComponent<Renderer>().material.DOOffset(new Vector2(0, 1), 1f);
tween.SetEase(ease);
//loop completed:
tween.OnComplete(() =>
{
spinNum--;
if (spinNum >= 1)
Spin(spinNum, ease); //next spin loop
else
IsSpinning = false; //finished !!
});
}
I tried with a For loop but with the same result, only the first call get executed, the others seems to be ignored..
IEnumerable Spin(int spinNum, Ease ease)
{
for (int i = 0; i < spinNum; i++)
{
tween = GetComponent<Renderer>().material.DOOffset(new Vector2(0, 1), 1f);
tween.SetEase(ease);
yield return new WaitForSeconds(1f);
}
}
I shared a complete small demo here:
https://onedrive.live.com/redir?resid=150B61C7D2D5A9BA!471158&authkey=!AFMymBYFnKNhMQw&ithint=file%2c7z
Please help.
Thanks a lot.
David